@miden-sdk/react 0.14.5 → 0.14.9

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.
@@ -1,100 +1,16 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- AuthScheme: () => import_lazy4.AuthScheme,
34
- DEFAULTS: () => DEFAULTS,
35
- MidenError: () => MidenError,
36
- MidenProvider: () => MidenProvider,
37
- MultiSignerProvider: () => MultiSignerProvider,
38
- SignerContext: () => SignerContext,
39
- SignerSlot: () => SignerSlot,
40
- accountIdsEqual: () => accountIdsEqual,
41
- bigIntToBytes: () => bigIntToBytes,
42
- bytesToBigInt: () => bytesToBigInt,
43
- clearMidenStorage: () => clearMidenStorage,
44
- concatBytes: () => concatBytes,
45
- createMidenStorage: () => createMidenStorage,
46
- createNoteAttachment: () => createNoteAttachment,
47
- formatAssetAmount: () => formatAssetAmount,
48
- formatNoteSummary: () => formatNoteSummary,
49
- getNoteSummary: () => getNoteSummary,
50
- migrateStorage: () => migrateStorage,
51
- normalizeAccountId: () => normalizeAccountId,
52
- parseAssetAmount: () => parseAssetAmount,
53
- readNoteAttachment: () => readNoteAttachment,
54
- toBech32AccountId: () => toBech32AccountId,
55
- useAccount: () => useAccount,
56
- useAccounts: () => useAccounts,
57
- useAssetMetadata: () => useAssetMetadata,
58
- useCompile: () => useCompile,
59
- useConsume: () => useConsume,
60
- useCreateFaucet: () => useCreateFaucet,
61
- useCreateWallet: () => useCreateWallet,
62
- useExecuteProgram: () => useExecuteProgram,
63
- useExportNote: () => useExportNote,
64
- useExportStore: () => useExportStore,
65
- useImportAccount: () => useImportAccount,
66
- useImportNote: () => useImportNote,
67
- useImportStore: () => useImportStore,
68
- useMiden: () => useMiden,
69
- useMidenClient: () => useMidenClient,
70
- useMint: () => useMint,
71
- useMultiSend: () => useMultiSend,
72
- useMultiSigner: () => useMultiSigner,
73
- useNoteStream: () => useNoteStream,
74
- useNotes: () => useNotes,
75
- useSend: () => useSend,
76
- useSessionAccount: () => useSessionAccount,
77
- useSigner: () => useSigner,
78
- useSwap: () => useSwap,
79
- useSyncControl: () => useSyncControl,
80
- useSyncState: () => useSyncState,
81
- useTransaction: () => useTransaction,
82
- useTransactionHistory: () => useTransactionHistory,
83
- useWaitForCommit: () => useWaitForCommit,
84
- useWaitForNotes: () => useWaitForNotes,
85
- waitForWalletDetection: () => waitForWalletDetection,
86
- wrapWasmError: () => wrapWasmError
87
- });
88
- module.exports = __toCommonJS(src_exports);
89
-
90
1
  // src/types/augmentations.ts
91
- var import_lazy = require("@miden-sdk/miden-sdk/lazy");
2
+ import "@miden-sdk/miden-sdk/mt";
92
3
 
93
4
  // src/utils/accountBech32.ts
94
- var import_lazy3 = require("@miden-sdk/miden-sdk/lazy");
5
+ import {
6
+ Account,
7
+ AccountInterface,
8
+ Address as Address2,
9
+ NetworkId
10
+ } from "@miden-sdk/miden-sdk/mt";
95
11
 
96
12
  // src/store/MidenStore.ts
97
- var import_zustand = require("zustand");
13
+ import { create } from "zustand";
98
14
  var initialSyncState = {
99
15
  syncHeight: 0,
100
16
  isSyncing: false,
@@ -126,7 +42,7 @@ function freshState() {
126
42
  ...freshCachedState()
127
43
  };
128
44
  }
129
- var useMidenStore = (0, import_zustand.create)()((set) => ({
45
+ var useMidenStore = create()((set) => ({
130
46
  ...freshState(),
131
47
  setClient: (client) => set({
132
48
  client,
@@ -238,19 +154,19 @@ var useAssetMetadataStore = () => useMidenStore((state) => state.assetMetadata);
238
154
  var useNoteFirstSeenStore = () => useMidenStore((state) => state.noteFirstSeen);
239
155
 
240
156
  // src/utils/accountParsing.ts
241
- var import_lazy2 = require("@miden-sdk/miden-sdk/lazy");
157
+ import { AccountId, Address } from "@miden-sdk/miden-sdk/mt";
242
158
  var normalizeAccountIdInput = (value) => value.trim().replace(/^miden:/i, "");
243
159
  var isBech32Input = (value) => value.startsWith("m") || value.startsWith("M");
244
160
  var normalizeHexInput = (value) => value.startsWith("0x") || value.startsWith("0X") ? value : `0x${value}`;
245
161
  var parseAccountIdFromString = (value) => {
246
162
  if (isBech32Input(value)) {
247
163
  try {
248
- return import_lazy2.Address.fromBech32(value).accountId();
164
+ return Address.fromBech32(value).accountId();
249
165
  } catch {
250
- return import_lazy2.AccountId.fromBech32(value);
166
+ return AccountId.fromBech32(value);
251
167
  }
252
168
  }
253
- return import_lazy2.AccountId.fromHex(normalizeHexInput(value));
169
+ return AccountId.fromHex(normalizeHexInput(value));
254
170
  };
255
171
  var parseAccountId = (value) => {
256
172
  if (typeof value === "string") {
@@ -277,49 +193,49 @@ function isFaucetId(accountId) {
277
193
  var parseAddress = (value, accountId) => {
278
194
  if (typeof value !== "string") {
279
195
  const resolvedId = accountId ?? parseAccountId(value);
280
- return import_lazy2.Address.fromAccountId(resolvedId, "BasicWallet");
196
+ return Address.fromAccountId(resolvedId, "BasicWallet");
281
197
  }
282
198
  const normalized = normalizeAccountIdInput(value);
283
199
  if (isBech32Input(normalized)) {
284
200
  try {
285
- return import_lazy2.Address.fromBech32(normalized);
201
+ return Address.fromBech32(normalized);
286
202
  } catch {
287
- const resolvedAccountId2 = accountId ?? import_lazy2.AccountId.fromBech32(normalized);
288
- return import_lazy2.Address.fromAccountId(resolvedAccountId2, "BasicWallet");
203
+ const resolvedAccountId2 = accountId ?? AccountId.fromBech32(normalized);
204
+ return Address.fromAccountId(resolvedAccountId2, "BasicWallet");
289
205
  }
290
206
  }
291
- const resolvedAccountId = accountId ?? import_lazy2.AccountId.fromHex(normalizeHexInput(normalized));
292
- return import_lazy2.Address.fromAccountId(resolvedAccountId, "BasicWallet");
207
+ const resolvedAccountId = accountId ?? AccountId.fromHex(normalizeHexInput(normalized));
208
+ return Address.fromAccountId(resolvedAccountId, "BasicWallet");
293
209
  };
294
210
 
295
211
  // src/utils/accountBech32.ts
296
212
  var inferNetworkId = () => {
297
213
  const { rpcUrl } = useMidenStore.getState().config;
298
214
  if (!rpcUrl) {
299
- return import_lazy3.NetworkId.testnet();
215
+ return NetworkId.testnet();
300
216
  }
301
217
  const url = rpcUrl.toLowerCase();
302
218
  if (url.includes("devnet") || url.includes("mdev")) {
303
- return import_lazy3.NetworkId.devnet();
219
+ return NetworkId.devnet();
304
220
  }
305
221
  if (url.includes("mainnet")) {
306
- return import_lazy3.NetworkId.mainnet();
222
+ return NetworkId.mainnet();
307
223
  }
308
224
  if (url.includes("testnet") || url.includes("mtst")) {
309
- return import_lazy3.NetworkId.testnet();
225
+ return NetworkId.testnet();
310
226
  }
311
- return import_lazy3.NetworkId.testnet();
227
+ return NetworkId.testnet();
312
228
  };
313
229
  var toBech32FromAccountId = (id) => {
314
230
  try {
315
- const address = import_lazy3.Address.fromAccountId(id, "BasicWallet");
231
+ const address = Address2.fromAccountId(id, "BasicWallet");
316
232
  return address.toBech32(inferNetworkId());
317
233
  } catch {
318
234
  }
319
235
  try {
320
236
  const maybeBech32 = id.toBech32?.(
321
237
  inferNetworkId(),
322
- import_lazy3.AccountInterface.BasicWallet
238
+ AccountInterface.BasicWallet
323
239
  );
324
240
  if (typeof maybeBech32 === "string") {
325
241
  return maybeBech32;
@@ -349,7 +265,7 @@ var defineBech32 = (target) => {
349
265
  }
350
266
  };
351
267
  var installAccountBech32 = () => {
352
- const proto = import_lazy3.Account.prototype;
268
+ const proto = Account.prototype;
353
269
  if (proto.bech32id) {
354
270
  return;
355
271
  }
@@ -381,18 +297,26 @@ var toBech32AccountId = (accountId) => {
381
297
  };
382
298
 
383
299
  // src/context/MidenProvider.tsx
384
- var import_react2 = require("react");
385
- var import_lazy6 = require("@miden-sdk/miden-sdk/lazy");
300
+ import {
301
+ createContext as createContext2,
302
+ useContext as useContext2,
303
+ useEffect,
304
+ useRef,
305
+ useCallback,
306
+ useMemo,
307
+ useState
308
+ } from "react";
309
+ import { WasmWebClient as WebClient } from "@miden-sdk/miden-sdk/mt";
386
310
 
387
311
  // src/types/index.ts
388
- var import_lazy4 = require("@miden-sdk/miden-sdk/lazy");
312
+ import { AuthScheme } from "@miden-sdk/miden-sdk/mt";
389
313
  var DEFAULTS = {
390
314
  RPC_URL: void 0,
391
315
  // Will use SDK's testnet default
392
316
  AUTO_SYNC_INTERVAL: 15e3,
393
317
  STORAGE_MODE: "private",
394
318
  WALLET_MUTABLE: true,
395
- AUTH_SCHEME: import_lazy4.AuthScheme.Falcon,
319
+ AUTH_SCHEME: AuthScheme.Falcon,
396
320
  NOTE_TYPE: "private",
397
321
  FAUCET_DECIMALS: 8
398
322
  };
@@ -436,7 +360,7 @@ function resolveRpcUrl(rpcUrl) {
436
360
  }
437
361
 
438
362
  // src/utils/prover.ts
439
- var import_lazy5 = require("@miden-sdk/miden-sdk/lazy");
363
+ import { TransactionProver } from "@miden-sdk/miden-sdk/mt";
440
364
  var DEFAULT_PROVER_URLS = {
441
365
  devnet: "https://tx-prover.devnet.miden.io",
442
366
  testnet: "https://tx-prover.testnet.miden.io"
@@ -475,19 +399,19 @@ function resolveProverTarget(target, config) {
475
399
  if (typeof target === "string") {
476
400
  const normalized = target.trim().toLowerCase();
477
401
  if (normalized === "local" || normalized === "localhost") {
478
- return import_lazy5.TransactionProver.newLocalProver();
402
+ return TransactionProver.newLocalProver();
479
403
  }
480
404
  if (normalized === "devnet" || normalized === "testnet") {
481
405
  const url = config.proverUrls?.[normalized] ?? DEFAULT_PROVER_URLS[normalized] ?? null;
482
406
  if (!url) {
483
407
  throw new Error(`Missing ${normalized} prover URL`);
484
408
  }
485
- return import_lazy5.TransactionProver.newRemoteProver(
409
+ return TransactionProver.newRemoteProver(
486
410
  url,
487
411
  normalizeTimeout(config.proverTimeoutMs)
488
412
  );
489
413
  }
490
- return import_lazy5.TransactionProver.newRemoteProver(
414
+ return TransactionProver.newRemoteProver(
491
415
  target,
492
416
  normalizeTimeout(config.proverTimeoutMs)
493
417
  );
@@ -499,8 +423,9 @@ function createRemoteProver(config, fallbackTimeout) {
499
423
  if (!url) {
500
424
  throw new Error("Remote prover requires a URL");
501
425
  }
502
- return import_lazy5.TransactionProver.newRemoteProver(
426
+ return TransactionProver.newRemoteProver(
503
427
  url,
428
+ /* v8 ignore next 1 — timeoutMs is always provided in tests; ?? fallbackTimeout path unreachable */
504
429
  normalizeTimeout(timeoutMs ?? fallbackTimeout)
505
430
  );
506
431
  }
@@ -515,10 +440,10 @@ function normalizeTimeout(timeoutMs) {
515
440
  }
516
441
 
517
442
  // src/context/SignerContext.ts
518
- var import_react = require("react");
519
- var SignerContext = (0, import_react.createContext)(null);
443
+ import { createContext, useContext } from "react";
444
+ var SignerContext = createContext(null);
520
445
  function useSigner() {
521
- return (0, import_react.useContext)(SignerContext);
446
+ return useContext(SignerContext);
522
447
  }
523
448
 
524
449
  // src/utils/signerAccount.ts
@@ -541,7 +466,7 @@ async function initializeSignerAccount(client, config) {
541
466
  AuthScheme: AuthScheme2,
542
467
  Word: Word2,
543
468
  resolveAuthScheme: resolveAuthScheme5
544
- } = await import("@miden-sdk/miden-sdk/lazy");
469
+ } = await import("@miden-sdk/miden-sdk/mt");
545
470
  await client.syncState();
546
471
  if (config.importAccountId) {
547
472
  const accountId2 = parseAccountId(config.importAccountId);
@@ -600,8 +525,8 @@ async function initializeSignerAccount(client, config) {
600
525
  }
601
526
 
602
527
  // src/context/MidenProvider.tsx
603
- var import_jsx_runtime = require("react/jsx-runtime");
604
- var MidenContext = (0, import_react2.createContext)(null);
528
+ import { Fragment, jsx } from "react/jsx-runtime";
529
+ var MidenContext = createContext2(null);
605
530
  function MidenProvider({
606
531
  children,
607
532
  config = {},
@@ -621,22 +546,22 @@ function MidenProvider({
621
546
  setSyncState,
622
547
  setSignerConnected
623
548
  } = useMidenStore();
624
- const syncIntervalRef = (0, import_react2.useRef)(null);
625
- const isInitializedRef = (0, import_react2.useRef)(false);
626
- const clientLockRef = (0, import_react2.useRef)(new AsyncLock());
627
- const currentStoreNameRef = (0, import_react2.useRef)(null);
628
- const signCbRef = (0, import_react2.useRef)(null);
549
+ const syncIntervalRef = useRef(null);
550
+ const isInitializedRef = useRef(false);
551
+ const clientLockRef = useRef(new AsyncLock());
552
+ const currentStoreNameRef = useRef(null);
553
+ const signCbRef = useRef(null);
629
554
  const signerContext = useSigner();
630
- const [signerAccountId, setSignerAccountId] = (0, import_react2.useState)(null);
631
- const resolvedConfig = (0, import_react2.useMemo)(
555
+ const [signerAccountId, setSignerAccountId] = useState(null);
556
+ const resolvedConfig = useMemo(
632
557
  () => ({
633
558
  ...config,
634
559
  rpcUrl: resolveRpcUrl(config.rpcUrl)
635
560
  }),
636
561
  [config]
637
562
  );
638
- const [defaultProver, setDefaultProver] = (0, import_react2.useState)(null);
639
- (0, import_react2.useEffect)(() => {
563
+ const [defaultProver, setDefaultProver] = useState(null);
564
+ useEffect(() => {
640
565
  if (!isReady) {
641
566
  setDefaultProver(null);
642
567
  return;
@@ -646,14 +571,16 @@ function MidenProvider({
646
571
  isReady,
647
572
  resolvedConfig.prover,
648
573
  resolvedConfig.proverTimeoutMs,
574
+ /* v8 ignore next 2 — optional chain on proverUrls; tests don't pass proverUrls config */
649
575
  resolvedConfig.proverUrls?.devnet,
650
576
  resolvedConfig.proverUrls?.testnet
651
577
  ]);
652
- const runExclusive = (0, import_react2.useCallback)(
578
+ const runExclusive = useCallback(
579
+ /* v8 ignore next 3 — runExclusive callback body; only called by advanced consumers, not directly in tests */
653
580
  async (fn) => clientLockRef.current.runExclusive(fn),
654
581
  []
655
582
  );
656
- const sync = (0, import_react2.useCallback)(async () => {
583
+ const sync = useCallback(async () => {
657
584
  if (!client || !isReady) return;
658
585
  const store = useMidenStore.getState();
659
586
  if (store.sync.isSyncing) return;
@@ -680,10 +607,12 @@ function MidenProvider({
680
607
  const signerStoreName = signerContext?.storeName ?? null;
681
608
  const signerAccountType = signerContext?.accountConfig?.accountType ?? null;
682
609
  const signerStorageMode = signerContext?.accountConfig?.storageMode?.toString() ?? null;
683
- (0, import_react2.useEffect)(() => {
610
+ useEffect(() => {
684
611
  signCbRef.current = signerContext?.signCb ?? null;
685
612
  }, [signerContext?.signCb]);
686
- const wrappedSignCb = (0, import_react2.useCallback)(
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. */
687
616
  async (pubKey, signingInputs) => {
688
617
  const cb = signCbRef.current;
689
618
  if (!cb) {
@@ -693,7 +622,7 @@ function MidenProvider({
693
622
  },
694
623
  []
695
624
  );
696
- (0, import_react2.useEffect)(() => {
625
+ useEffect(() => {
697
626
  if (signerIsConnected === null && isInitializedRef.current) return;
698
627
  if (signerIsConnected === false) {
699
628
  const store = useMidenStore.getState();
@@ -727,14 +656,16 @@ function MidenProvider({
727
656
  if (signerContext && signerIsConnected === true) {
728
657
  const storeName = `MidenClientDB_${signerContext.storeName}`;
729
658
  signCbRef.current = signerContext.signCb;
730
- webClient = await import_lazy6.WasmWebClient.createClientWithExternalKeystore(
659
+ webClient = await WebClient.createClientWithExternalKeystore(
731
660
  resolvedConfig.rpcUrl,
732
661
  resolvedConfig.noteTransportUrl,
733
662
  resolvedConfig.seed,
734
663
  storeName,
735
664
  signerContext.getKeyCb,
736
665
  signerContext.insertKeyCb,
737
- wrappedSignCb
666
+ wrappedSignCb,
667
+ void 0,
668
+ resolvedConfig.useWorker
738
669
  );
739
670
  if (cancelled) return;
740
671
  const accountId = await initializeSignerAccount(
@@ -747,10 +678,13 @@ function MidenProvider({
747
678
  currentStoreNameRef.current = signerContext.storeName;
748
679
  } else {
749
680
  const seed = resolvedConfig.seed;
750
- webClient = await import_lazy6.WasmWebClient.createClient(
681
+ webClient = await WebClient.createClient(
751
682
  resolvedConfig.rpcUrl,
752
683
  resolvedConfig.noteTransportUrl,
753
- seed
684
+ seed,
685
+ void 0,
686
+ void 0,
687
+ resolvedConfig.useWorker
754
688
  );
755
689
  if (cancelled) return;
756
690
  }
@@ -816,7 +750,7 @@ function MidenProvider({
816
750
  // signCb changes are handled by the dedicated useEffect + signCbRef above,
817
751
  // not by this effect.
818
752
  ]);
819
- (0, import_react2.useEffect)(() => {
753
+ useEffect(() => {
820
754
  if (!isReady || !client) return;
821
755
  const interval = config.autoSyncInterval ?? DEFAULTS.AUTO_SYNC_INTERVAL;
822
756
  if (interval <= 0) return;
@@ -832,7 +766,7 @@ function MidenProvider({
832
766
  }
833
767
  };
834
768
  }, [isReady, client, config.autoSyncInterval, sync]);
835
- (0, import_react2.useEffect)(() => {
769
+ useEffect(() => {
836
770
  if (!isReady || !client) return;
837
771
  const unsubscribe = client.onStateChanged?.(async () => {
838
772
  try {
@@ -847,13 +781,13 @@ function MidenProvider({
847
781
  };
848
782
  }, [isReady, client, setSyncState]);
849
783
  if (isInitializing && loadingComponent) {
850
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: loadingComponent });
784
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
851
785
  }
852
786
  if (initError && errorComponent) {
853
787
  if (typeof errorComponent === "function") {
854
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: errorComponent(initError) });
788
+ return /* @__PURE__ */ jsx(Fragment, { children: errorComponent(initError) });
855
789
  }
856
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: errorComponent });
790
+ return /* @__PURE__ */ jsx(Fragment, { children: errorComponent });
857
791
  }
858
792
  const contextValue = {
859
793
  client,
@@ -866,10 +800,10 @@ function MidenProvider({
866
800
  signerAccountId,
867
801
  signerConnected
868
802
  };
869
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MidenContext.Provider, { value: contextValue, children });
803
+ return /* @__PURE__ */ jsx(MidenContext.Provider, { value: contextValue, children });
870
804
  }
871
805
  function useMiden() {
872
- const context = (0, import_react2.useContext)(MidenContext);
806
+ const context = useContext2(MidenContext);
873
807
  if (!context) {
874
808
  throw new Error("useMiden must be used within a MidenProvider");
875
809
  }
@@ -886,22 +820,30 @@ function useMidenClient() {
886
820
  }
887
821
 
888
822
  // src/context/MultiSignerProvider.tsx
889
- var import_react3 = require("react");
890
- var import_jsx_runtime2 = require("react/jsx-runtime");
891
- var MultiSignerRegistryContext = (0, import_react3.createContext)(null);
892
- var MultiSignerContext = (0, import_react3.createContext)(null);
823
+ import {
824
+ createContext as createContext3,
825
+ useContext as useContext3,
826
+ useEffect as useEffect2,
827
+ useRef as useRef2,
828
+ useState as useState2,
829
+ useCallback as useCallback2,
830
+ useMemo as useMemo2
831
+ } from "react";
832
+ import { jsx as jsx2 } from "react/jsx-runtime";
833
+ var MultiSignerRegistryContext = createContext3(null);
834
+ var MultiSignerContext = createContext3(null);
893
835
  function MultiSignerProvider({ children }) {
894
- const signersRef = (0, import_react3.useRef)(/* @__PURE__ */ new Map());
895
- const [signersSnapshot, setSignersSnapshot] = (0, import_react3.useState)(
836
+ const signersRef = useRef2(/* @__PURE__ */ new Map());
837
+ const [signersSnapshot, setSignersSnapshot] = useState2(
896
838
  []
897
839
  );
898
- const [activeSignerName, setActiveSignerName] = (0, import_react3.useState)(null);
899
- const activeSignerNameRef = (0, import_react3.useRef)(null);
900
- const generationRef = (0, import_react3.useRef)(0);
901
- const updateSnapshot = (0, import_react3.useCallback)(() => {
840
+ const [activeSignerName, setActiveSignerName] = useState2(null);
841
+ const activeSignerNameRef = useRef2(null);
842
+ const generationRef = useRef2(0);
843
+ const updateSnapshot = useCallback2(() => {
902
844
  setSignersSnapshot(Array.from(signersRef.current.values()));
903
845
  }, []);
904
- const register = (0, import_react3.useCallback)(
846
+ const register = useCallback2(
905
847
  (value) => {
906
848
  const prev = signersRef.current.get(value.name);
907
849
  signersRef.current.set(value.name, value);
@@ -911,7 +853,7 @@ function MultiSignerProvider({ children }) {
911
853
  },
912
854
  [updateSnapshot]
913
855
  );
914
- const unregister = (0, import_react3.useCallback)(
856
+ const unregister = useCallback2(
915
857
  (name) => {
916
858
  signersRef.current.delete(name);
917
859
  setActiveSignerName((current) => current === name ? null : current);
@@ -919,12 +861,15 @@ function MultiSignerProvider({ children }) {
919
861
  },
920
862
  [updateSnapshot]
921
863
  );
922
- const registry = (0, import_react3.useMemo)(
864
+ const registry = useMemo2(
923
865
  () => ({ register, unregister }),
924
866
  [register, unregister]
925
867
  );
926
- const activeSigner = activeSignerName ? signersSnapshot.find((s) => s.name === activeSignerName) ?? null : null;
927
- const stableSignCb = (0, import_react3.useCallback)(
868
+ const activeSigner = activeSignerName ? (
869
+ /* v8 ignore next 1 — ?? null fallback; find() returns undefined only when the signer was unregistered between renders */
870
+ signersSnapshot.find((s) => s.name === activeSignerName) ?? null
871
+ ) : null;
872
+ const stableSignCb = useCallback2(
928
873
  async (pubKey, signingInputs) => {
929
874
  const name = activeSignerName;
930
875
  if (!name) throw new Error("No active signer (signer was disconnected)");
@@ -934,21 +879,21 @@ function MultiSignerProvider({ children }) {
934
879
  },
935
880
  [activeSignerName]
936
881
  );
937
- const stableConnect = (0, import_react3.useCallback)(async () => {
882
+ const stableConnect = useCallback2(async () => {
938
883
  const name = activeSignerName;
939
884
  if (!name) throw new Error("No active signer (signer was disconnected)");
940
885
  const signer = signersRef.current.get(name);
941
886
  if (!signer) throw new Error(`Signer "${name}" not found in registry`);
942
887
  return signer.connect();
943
888
  }, [activeSignerName]);
944
- const stableDisconnect = (0, import_react3.useCallback)(async () => {
889
+ const stableDisconnect = useCallback2(async () => {
945
890
  const name = activeSignerName;
946
891
  if (!name) throw new Error("No active signer (signer was disconnected)");
947
892
  const signer = signersRef.current.get(name);
948
893
  if (!signer) throw new Error(`Signer "${name}" not found in registry`);
949
894
  return signer.disconnect();
950
895
  }, [activeSignerName]);
951
- const forwardedValue = (0, import_react3.useMemo)(() => {
896
+ const forwardedValue = useMemo2(() => {
952
897
  if (!activeSigner) return null;
953
898
  return {
954
899
  name: activeSigner.name,
@@ -968,11 +913,11 @@ function MultiSignerProvider({ children }) {
968
913
  stableConnect,
969
914
  stableDisconnect
970
915
  ]);
971
- const setActiveName = (0, import_react3.useCallback)((name) => {
916
+ const setActiveName = useCallback2((name) => {
972
917
  activeSignerNameRef.current = name;
973
918
  setActiveSignerName(name);
974
919
  }, []);
975
- const connectSigner = (0, import_react3.useCallback)(
920
+ const connectSigner = useCallback2(
976
921
  async (name) => {
977
922
  const currentName = activeSignerNameRef.current;
978
923
  const currentSigner = currentName ? signersRef.current.get(currentName) : null;
@@ -997,7 +942,7 @@ function MultiSignerProvider({ children }) {
997
942
  },
998
943
  [setActiveName]
999
944
  );
1000
- const disconnectSigner = (0, import_react3.useCallback)(async () => {
945
+ const disconnectSigner = useCallback2(async () => {
1001
946
  ++generationRef.current;
1002
947
  const currentName = activeSignerNameRef.current;
1003
948
  const signer = currentName ? signersRef.current.get(currentName) : null;
@@ -1008,7 +953,7 @@ function MultiSignerProvider({ children }) {
1008
953
  });
1009
954
  }
1010
955
  }, [setActiveName]);
1011
- const multiSignerValue = (0, import_react3.useMemo)(
956
+ const multiSignerValue = useMemo2(
1012
957
  () => ({
1013
958
  signers: signersSnapshot,
1014
959
  activeSigner,
@@ -1017,18 +962,18 @@ function MultiSignerProvider({ children }) {
1017
962
  }),
1018
963
  [signersSnapshot, activeSigner, connectSigner, disconnectSigner]
1019
964
  );
1020
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SignerContext.Provider, { value: forwardedValue, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MultiSignerRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MultiSignerContext.Provider, { value: multiSignerValue, children }) }) });
965
+ return /* @__PURE__ */ jsx2(SignerContext.Provider, { value: forwardedValue, children: /* @__PURE__ */ jsx2(MultiSignerRegistryContext.Provider, { value: registry, children: /* @__PURE__ */ jsx2(MultiSignerContext.Provider, { value: multiSignerValue, children }) }) });
1021
966
  }
1022
967
  function SignerSlot() {
1023
968
  const signerValue = useSigner();
1024
- const registry = (0, import_react3.useContext)(MultiSignerRegistryContext);
1025
- const nameRef = (0, import_react3.useRef)();
1026
- (0, import_react3.useEffect)(() => {
969
+ const registry = useContext3(MultiSignerRegistryContext);
970
+ const nameRef = useRef2();
971
+ useEffect2(() => {
1027
972
  if (!signerValue || !registry) return;
1028
973
  nameRef.current = signerValue.name;
1029
974
  registry.register(signerValue);
1030
975
  }, [signerValue, registry]);
1031
- (0, import_react3.useEffect)(() => {
976
+ useEffect2(() => {
1032
977
  return () => {
1033
978
  if (nameRef.current && registry) {
1034
979
  registry.unregister(nameRef.current);
@@ -1038,18 +983,18 @@ function SignerSlot() {
1038
983
  return null;
1039
984
  }
1040
985
  function useMultiSigner() {
1041
- return (0, import_react3.useContext)(MultiSignerContext);
986
+ return useContext3(MultiSignerContext);
1042
987
  }
1043
988
 
1044
989
  // src/hooks/useAccounts.ts
1045
- var import_react4 = require("react");
990
+ import { useCallback as useCallback3, useEffect as useEffect3 } from "react";
1046
991
  function useAccounts() {
1047
992
  const { client, isReady } = useMiden();
1048
993
  const accounts = useAccountsStore();
1049
994
  const isLoadingAccounts = useMidenStore((state) => state.isLoadingAccounts);
1050
995
  const setLoadingAccounts = useMidenStore((state) => state.setLoadingAccounts);
1051
996
  const setAccounts = useMidenStore((state) => state.setAccounts);
1052
- const refetch = (0, import_react4.useCallback)(async () => {
997
+ const refetch = useCallback3(async () => {
1053
998
  if (!client || !isReady) return;
1054
999
  setLoadingAccounts(true);
1055
1000
  try {
@@ -1061,7 +1006,7 @@ function useAccounts() {
1061
1006
  setLoadingAccounts(false);
1062
1007
  }
1063
1008
  }, [client, isReady, setAccounts, setLoadingAccounts]);
1064
- (0, import_react4.useEffect)(() => {
1009
+ useEffect3(() => {
1065
1010
  if (isReady && accounts.length === 0) {
1066
1011
  refetch();
1067
1012
  }
@@ -1087,11 +1032,15 @@ function useAccounts() {
1087
1032
  }
1088
1033
 
1089
1034
  // src/hooks/useAccount.ts
1090
- var import_react6 = require("react");
1035
+ import { useCallback as useCallback4, useEffect as useEffect5, useState as useState3, useMemo as useMemo4 } from "react";
1091
1036
 
1092
1037
  // src/hooks/useAssetMetadata.ts
1093
- var import_react5 = require("react");
1094
- var import_lazy7 = require("@miden-sdk/miden-sdk/lazy");
1038
+ import { useEffect as useEffect4, useMemo as useMemo3 } from "react";
1039
+ import {
1040
+ BasicFungibleFaucetComponent,
1041
+ Endpoint,
1042
+ RpcClient
1043
+ } from "@miden-sdk/miden-sdk/mt";
1095
1044
  var inflight = /* @__PURE__ */ new Map();
1096
1045
  var rpcClients = /* @__PURE__ */ new Map();
1097
1046
  var getRpcClient = (rpcUrl) => {
@@ -1099,8 +1048,8 @@ var getRpcClient = (rpcUrl) => {
1099
1048
  const existing = rpcClients.get(key);
1100
1049
  if (existing) return existing;
1101
1050
  try {
1102
- const endpoint = rpcUrl ? new import_lazy7.Endpoint(rpcUrl) : import_lazy7.Endpoint.testnet();
1103
- const client = new import_lazy7.RpcClient(endpoint);
1051
+ const endpoint = rpcUrl ? new Endpoint(rpcUrl) : Endpoint.testnet();
1052
+ const client = new RpcClient(endpoint);
1104
1053
  rpcClients.set(key, client);
1105
1054
  return client;
1106
1055
  } catch {
@@ -1114,7 +1063,7 @@ var fetchAssetMetadata = async (rpcClient, assetId) => {
1114
1063
  const fetched = await rpcClient.getAccountDetails(accountId);
1115
1064
  const account = fetched.account?.();
1116
1065
  if (!account) return null;
1117
- const faucet = import_lazy7.BasicFungibleFaucetComponent.fromAccount(account);
1066
+ const faucet = BasicFungibleFaucetComponent.fromAccount(account);
1118
1067
  const symbol = faucet.symbol().toString();
1119
1068
  const decimals = faucet.decimals();
1120
1069
  return { assetId, symbol, decimals };
@@ -1126,12 +1075,12 @@ function useAssetMetadata(assetIds = []) {
1126
1075
  const assetMetadata = useAssetMetadataStore();
1127
1076
  const setAssetMetadata = useMidenStore((state) => state.setAssetMetadata);
1128
1077
  const rpcUrl = useMidenStore((state) => state.config.rpcUrl);
1129
- const rpcClient = (0, import_react5.useMemo)(() => getRpcClient(rpcUrl), [rpcUrl]);
1130
- const uniqueAssetIds = (0, import_react5.useMemo)(
1078
+ const rpcClient = useMemo3(() => getRpcClient(rpcUrl), [rpcUrl]);
1079
+ const uniqueAssetIds = useMemo3(
1131
1080
  () => Array.from(new Set(assetIds.filter(Boolean))),
1132
1081
  [assetIds]
1133
1082
  );
1134
- (0, import_react5.useEffect)(() => {
1083
+ useEffect4(() => {
1135
1084
  if (!rpcClient || uniqueAssetIds.length === 0) return;
1136
1085
  uniqueAssetIds.forEach((assetId) => {
1137
1086
  const existing = assetMetadata.get(assetId);
@@ -1154,15 +1103,15 @@ function useAccount(accountId) {
1154
1103
  const accountDetails = useMidenStore((state) => state.accountDetails);
1155
1104
  const setAccountDetails = useMidenStore((state) => state.setAccountDetails);
1156
1105
  const { lastSyncTime } = useSyncStateStore();
1157
- const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
1158
- const [error, setError] = (0, import_react6.useState)(null);
1159
- const accountIdStr = (0, import_react6.useMemo)(() => {
1106
+ const [isLoading, setIsLoading] = useState3(false);
1107
+ const [error, setError] = useState3(null);
1108
+ const accountIdStr = useMemo4(() => {
1160
1109
  if (!accountId) return void 0;
1161
1110
  if (typeof accountId === "string") return accountId;
1162
1111
  return parseAccountId(accountId).toString();
1163
1112
  }, [accountId]);
1164
1113
  const account = accountIdStr ? accountDetails.get(accountIdStr) ?? null : null;
1165
- const refetch = (0, import_react6.useCallback)(async () => {
1114
+ const refetch = useCallback4(async () => {
1166
1115
  if (!client || !isReady || !accountIdStr) return;
1167
1116
  setIsLoading(true);
1168
1117
  setError(null);
@@ -1179,16 +1128,16 @@ function useAccount(accountId) {
1179
1128
  setIsLoading(false);
1180
1129
  }
1181
1130
  }, [client, isReady, accountIdStr, setAccountDetails]);
1182
- (0, import_react6.useEffect)(() => {
1131
+ useEffect5(() => {
1183
1132
  if (isReady && accountIdStr && !account) {
1184
1133
  refetch();
1185
1134
  }
1186
1135
  }, [isReady, accountIdStr, account, refetch]);
1187
- (0, import_react6.useEffect)(() => {
1136
+ useEffect5(() => {
1188
1137
  if (!isReady || !accountIdStr || !lastSyncTime) return;
1189
1138
  refetch();
1190
1139
  }, [isReady, accountIdStr, lastSyncTime, refetch]);
1191
- const rawAssets = (0, import_react6.useMemo)(() => {
1140
+ const rawAssets = useMemo4(() => {
1192
1141
  if (!account) return [];
1193
1142
  try {
1194
1143
  const vault = account.vault();
@@ -1205,12 +1154,12 @@ function useAccount(accountId) {
1205
1154
  return [];
1206
1155
  }
1207
1156
  }, [account]);
1208
- const assetIds = (0, import_react6.useMemo)(
1157
+ const assetIds = useMemo4(
1209
1158
  () => rawAssets.map((asset) => asset.assetId),
1210
1159
  [rawAssets]
1211
1160
  );
1212
1161
  const { assetMetadata } = useAssetMetadata(assetIds);
1213
- const assets = (0, import_react6.useMemo)(
1162
+ const assets = useMemo4(
1214
1163
  () => rawAssets.map((asset) => {
1215
1164
  const metadata = assetMetadata.get(asset.assetId);
1216
1165
  return {
@@ -1221,7 +1170,7 @@ function useAccount(accountId) {
1221
1170
  }),
1222
1171
  [rawAssets, assetMetadata]
1223
1172
  );
1224
- const getBalance = (0, import_react6.useCallback)(
1173
+ const getBalance = useCallback4(
1225
1174
  (assetId) => {
1226
1175
  const asset = assets.find((a) => a.assetId === assetId);
1227
1176
  return asset?.amount ?? 0n;
@@ -1239,8 +1188,8 @@ function useAccount(accountId) {
1239
1188
  }
1240
1189
 
1241
1190
  // src/hooks/useNotes.ts
1242
- var import_react7 = require("react");
1243
- var import_lazy9 = require("@miden-sdk/miden-sdk/lazy");
1191
+ import { useCallback as useCallback5, useEffect as useEffect6, useMemo as useMemo5, useState as useState4 } from "react";
1192
+ import { NoteFilter } from "@miden-sdk/miden-sdk/mt";
1244
1193
 
1245
1194
  // src/utils/amounts.ts
1246
1195
  var formatAssetAmount = (amount, decimals) => {
@@ -1345,30 +1294,35 @@ function accountIdsEqual(a, b) {
1345
1294
  }
1346
1295
 
1347
1296
  // src/utils/noteFilters.ts
1348
- var import_lazy8 = require("@miden-sdk/miden-sdk/lazy");
1297
+ import {
1298
+ NoteFilterTypes,
1299
+ NoteType,
1300
+ TransactionFilter
1301
+ } from "@miden-sdk/miden-sdk/mt";
1349
1302
  function getNoteFilterType(status) {
1350
1303
  switch (status) {
1351
1304
  case "consumed":
1352
- return import_lazy8.NoteFilterTypes.Consumed;
1305
+ return NoteFilterTypes.Consumed;
1353
1306
  case "committed":
1354
- return import_lazy8.NoteFilterTypes.Committed;
1307
+ return NoteFilterTypes.Committed;
1355
1308
  case "expected":
1356
- return import_lazy8.NoteFilterTypes.Expected;
1309
+ return NoteFilterTypes.Expected;
1357
1310
  case "processing":
1358
- return import_lazy8.NoteFilterTypes.Processing;
1311
+ return NoteFilterTypes.Processing;
1359
1312
  case "all":
1360
1313
  default:
1361
- return import_lazy8.NoteFilterTypes.All;
1314
+ return NoteFilterTypes.All;
1362
1315
  }
1363
1316
  }
1364
1317
  function getNoteType(type) {
1365
1318
  switch (type) {
1366
1319
  case "private":
1367
- return import_lazy8.NoteType.Private;
1320
+ return NoteType.Private;
1368
1321
  case "public":
1369
- return import_lazy8.NoteType.Public;
1322
+ return NoteType.Public;
1323
+ /* v8 ignore next 2 — TypeScript type ensures only "private"|"public"; default is unreachable */
1370
1324
  default:
1371
- return import_lazy8.NoteType.Private;
1325
+ return NoteType.Private;
1372
1326
  }
1373
1327
  }
1374
1328
  async function waitForTransactionCommit(client, runExclusiveSafe, txIdHex, maxWaitMs = 1e4, delayMs = 1e3) {
@@ -1377,7 +1331,7 @@ async function waitForTransactionCommit(client, runExclusiveSafe, txIdHex, maxWa
1377
1331
  while (Date.now() < deadline) {
1378
1332
  await runExclusiveSafe(() => client.syncState());
1379
1333
  const records = await runExclusiveSafe(
1380
- () => client.getTransactions(import_lazy8.TransactionFilter.all())
1334
+ () => client.getTransactions(TransactionFilter.all())
1381
1335
  );
1382
1336
  const record = records.find(
1383
1337
  (r) => normalizeHex(r.id().toHex()) === targetHex
@@ -1413,14 +1367,14 @@ function useNotes(options) {
1413
1367
  (state) => state.setConsumableNotesIfChanged
1414
1368
  );
1415
1369
  const { lastSyncTime } = useSyncStateStore();
1416
- const [error, setError] = (0, import_react7.useState)(null);
1417
- const refetch = (0, import_react7.useCallback)(async () => {
1370
+ const [error, setError] = useState4(null);
1371
+ const refetch = useCallback5(async () => {
1418
1372
  if (!client || !isReady) return;
1419
1373
  setLoadingNotes(true);
1420
1374
  setError(null);
1421
1375
  try {
1422
1376
  const filterType = getNoteFilterType(options?.status);
1423
- const filter = new import_lazy9.NoteFilter(filterType);
1377
+ const filter = new NoteFilter(filterType);
1424
1378
  const fetchedNotes = await client.getInputNotes(filter);
1425
1379
  let fetchedConsumable;
1426
1380
  if (options?.accountId) {
@@ -1445,16 +1399,16 @@ function useNotes(options) {
1445
1399
  setNotesIfChanged,
1446
1400
  setConsumableNotesIfChanged
1447
1401
  ]);
1448
- (0, import_react7.useEffect)(() => {
1402
+ useEffect6(() => {
1449
1403
  if (isReady && notes.length === 0) {
1450
1404
  refetch();
1451
1405
  }
1452
1406
  }, [isReady, notes.length, refetch]);
1453
- (0, import_react7.useEffect)(() => {
1407
+ useEffect6(() => {
1454
1408
  if (!isReady || !lastSyncTime) return;
1455
1409
  refetch();
1456
1410
  }, [isReady, lastSyncTime, refetch]);
1457
- const noteAssetIds = (0, import_react7.useMemo)(() => {
1411
+ const noteAssetIds = useMemo5(() => {
1458
1412
  const ids = /* @__PURE__ */ new Set();
1459
1413
  const collect = (note) => {
1460
1414
  const summary = getNoteSummary(note);
@@ -1466,11 +1420,11 @@ function useNotes(options) {
1466
1420
  return Array.from(ids);
1467
1421
  }, [notes, consumableNotes]);
1468
1422
  const { assetMetadata } = useAssetMetadata(noteAssetIds);
1469
- const getMetadata = (0, import_react7.useCallback)(
1423
+ const getMetadata = useCallback5(
1470
1424
  (assetId) => assetMetadata.get(assetId),
1471
1425
  [assetMetadata]
1472
1426
  );
1473
- const normalizedSender = (0, import_react7.useMemo)(() => {
1427
+ const normalizedSender = useMemo5(() => {
1474
1428
  if (!options?.sender) return null;
1475
1429
  try {
1476
1430
  return normalizeAccountId(options.sender);
@@ -1478,11 +1432,11 @@ function useNotes(options) {
1478
1432
  return options.sender;
1479
1433
  }
1480
1434
  }, [options?.sender]);
1481
- const excludeIdsKey = (0, import_react7.useMemo)(() => {
1435
+ const excludeIdsKey = useMemo5(() => {
1482
1436
  if (!options?.excludeIds || options.excludeIds.length === 0) return "";
1483
1437
  return [...options.excludeIds].sort().join("\0");
1484
1438
  }, [options?.excludeIds]);
1485
- const filterBySender = (0, import_react7.useCallback)(
1439
+ const filterBySender = useCallback5(
1486
1440
  (summaries, target) => {
1487
1441
  const cache = /* @__PURE__ */ new Map();
1488
1442
  return summaries.filter((s) => {
@@ -1501,7 +1455,7 @@ function useNotes(options) {
1501
1455
  },
1502
1456
  []
1503
1457
  );
1504
- const noteSummaries = (0, import_react7.useMemo)(() => {
1458
+ const noteSummaries = useMemo5(() => {
1505
1459
  let summaries = notes.map((note) => getNoteSummary(note, getMetadata)).filter(Boolean);
1506
1460
  if (normalizedSender) {
1507
1461
  summaries = filterBySender(summaries, normalizedSender);
@@ -1512,7 +1466,7 @@ function useNotes(options) {
1512
1466
  }
1513
1467
  return summaries;
1514
1468
  }, [notes, getMetadata, normalizedSender, excludeIdsKey, filterBySender]);
1515
- const consumableNoteSummaries = (0, import_react7.useMemo)(() => {
1469
+ const consumableNoteSummaries = useMemo5(() => {
1516
1470
  let summaries = consumableNotes.map((note) => getNoteSummary(note, getMetadata)).filter(Boolean);
1517
1471
  if (normalizedSender) {
1518
1472
  summaries = filterBySender(summaries, normalizedSender);
@@ -1541,11 +1495,16 @@ function useNotes(options) {
1541
1495
  }
1542
1496
 
1543
1497
  // src/hooks/useNoteStream.ts
1544
- var import_react8 = require("react");
1545
- var import_lazy11 = require("@miden-sdk/miden-sdk/lazy");
1498
+ import { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo6, useRef as useRef3, useState as useState5 } from "react";
1499
+ import { NoteFilter as NoteFilter2 } from "@miden-sdk/miden-sdk/mt";
1546
1500
 
1547
1501
  // src/utils/noteAttachment.ts
1548
- var import_lazy10 = require("@miden-sdk/miden-sdk/lazy");
1502
+ import {
1503
+ NoteAttachment,
1504
+ NoteAttachmentKind,
1505
+ NoteAttachmentScheme,
1506
+ Word
1507
+ } from "@miden-sdk/miden-sdk/mt";
1549
1508
  function readNoteAttachment(note) {
1550
1509
  try {
1551
1510
  const metadata = note.metadata?.();
@@ -1554,8 +1513,8 @@ function readNoteAttachment(note) {
1554
1513
  if (!attachment) return null;
1555
1514
  const kind = attachment.kind?.();
1556
1515
  if (!kind) return null;
1557
- if (kind === import_lazy10.NoteAttachmentKind.None) return null;
1558
- if (kind === import_lazy10.NoteAttachmentKind.Word) {
1516
+ if (kind === NoteAttachmentKind.None) return null;
1517
+ if (kind === NoteAttachmentKind.Word) {
1559
1518
  const word = attachment.asWord?.();
1560
1519
  if (!word) return null;
1561
1520
  const u64s = word.toU64s();
@@ -1564,7 +1523,7 @@ function readNoteAttachment(note) {
1564
1523
  );
1565
1524
  return { values, kind: "word" };
1566
1525
  }
1567
- if (kind === import_lazy10.NoteAttachmentKind.Array) {
1526
+ if (kind === NoteAttachmentKind.Array) {
1568
1527
  const arr = attachment.asArray?.();
1569
1528
  if (!arr) return null;
1570
1529
  const u64s = arr.toU64s();
@@ -1584,30 +1543,30 @@ function createNoteAttachment(values) {
1584
1543
  bigints.push(BigInt(values[i]));
1585
1544
  }
1586
1545
  if (bigints.length === 0) {
1587
- return new import_lazy10.NoteAttachment();
1546
+ return new NoteAttachment();
1588
1547
  }
1589
- const scheme = import_lazy10.NoteAttachmentScheme.none();
1548
+ const scheme = NoteAttachmentScheme.none();
1590
1549
  if (bigints.length <= 4) {
1591
1550
  while (bigints.length < 4) {
1592
1551
  bigints.push(0n);
1593
1552
  }
1594
- const word = new import_lazy10.Word(BigUint64Array.from(bigints));
1595
- return import_lazy10.NoteAttachment.newWord(scheme, word);
1553
+ const word = new Word(BigUint64Array.from(bigints));
1554
+ return NoteAttachment.newWord(scheme, word);
1596
1555
  }
1597
1556
  while (bigints.length % 4 !== 0) {
1598
1557
  bigints.push(0n);
1599
1558
  }
1600
1559
  const words = [];
1601
1560
  for (let i = 0; i < bigints.length; i += 4) {
1602
- words.push(new import_lazy10.Word(BigUint64Array.from(bigints.slice(i, i + 4))));
1561
+ words.push(new Word(BigUint64Array.from(bigints.slice(i, i + 4))));
1603
1562
  }
1604
- const newArray = import_lazy10.NoteAttachment["newArray"];
1563
+ const newArray = NoteAttachment["newArray"];
1605
1564
  if (typeof newArray !== "function") {
1606
1565
  throw new Error(
1607
1566
  "NoteAttachment.newArray is not available. Ensure @miden-sdk/miden-sdk >= 0.13.1."
1608
1567
  );
1609
1568
  }
1610
- return newArray.call(import_lazy10.NoteAttachment, scheme, words);
1569
+ return newArray.call(NoteAttachment, scheme, words);
1611
1570
  }
1612
1571
 
1613
1572
  // src/hooks/useNoteStream.ts
@@ -1617,32 +1576,32 @@ function useNoteStream(options = {}) {
1617
1576
  const noteFirstSeen = useNoteFirstSeenStore();
1618
1577
  const { lastSyncTime } = useSyncStateStore();
1619
1578
  const setNotesIfChanged = useMidenStore((state) => state.setNotesIfChanged);
1620
- const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
1621
- const [error, setError] = (0, import_react8.useState)(null);
1622
- const handledIdsRef = (0, import_react8.useRef)(/* @__PURE__ */ new Set());
1623
- const [handledVersion, setHandledVersion] = (0, import_react8.useState)(0);
1579
+ const [isLoading, setIsLoading] = useState5(false);
1580
+ const [error, setError] = useState5(null);
1581
+ const handledIdsRef = useRef3(/* @__PURE__ */ new Set());
1582
+ const [handledVersion, setHandledVersion] = useState5(0);
1624
1583
  const status = options.status ?? "committed";
1625
1584
  const sender = options.sender ?? null;
1626
1585
  const since = options.since;
1627
- const amountFilterRef = (0, import_react8.useRef)(options.amountFilter);
1586
+ const amountFilterRef = useRef3(options.amountFilter);
1628
1587
  amountFilterRef.current = options.amountFilter;
1629
- const excludeIdsKey = (0, import_react8.useMemo)(() => {
1588
+ const excludeIdsKey = useMemo6(() => {
1630
1589
  if (!options.excludeIds) return "";
1631
1590
  if (options.excludeIds instanceof Set)
1632
1591
  return Array.from(options.excludeIds).sort().join("\0");
1633
1592
  return [...options.excludeIds].sort().join("\0");
1634
1593
  }, [options.excludeIds]);
1635
- const excludeIdSet = (0, import_react8.useMemo)(() => {
1594
+ const excludeIdSet = useMemo6(() => {
1636
1595
  if (!excludeIdsKey) return null;
1637
1596
  return new Set(excludeIdsKey.split("\0"));
1638
1597
  }, [excludeIdsKey]);
1639
- const refetch = (0, import_react8.useCallback)(async () => {
1598
+ const refetch = useCallback6(async () => {
1640
1599
  if (!client || !isReady) return;
1641
1600
  setIsLoading(true);
1642
1601
  setError(null);
1643
1602
  try {
1644
1603
  const filterType = getNoteFilterType(status);
1645
- const filter = new import_lazy11.NoteFilter(filterType);
1604
+ const filter = new NoteFilter2(filterType);
1646
1605
  const fetched = await client.getInputNotes(filter);
1647
1606
  setNotesIfChanged(fetched);
1648
1607
  } catch (err) {
@@ -1651,12 +1610,12 @@ function useNoteStream(options = {}) {
1651
1610
  setIsLoading(false);
1652
1611
  }
1653
1612
  }, [client, isReady, status, setNotesIfChanged]);
1654
- (0, import_react8.useEffect)(() => {
1613
+ useEffect7(() => {
1655
1614
  if (isReady) {
1656
1615
  refetch();
1657
1616
  }
1658
1617
  }, [isReady, lastSyncTime, refetch]);
1659
- const streamedNotes = (0, import_react8.useMemo)(() => {
1618
+ const streamedNotes = useMemo6(() => {
1660
1619
  void handledVersion;
1661
1620
  const result = [];
1662
1621
  let normalizedSender = null;
@@ -1681,15 +1640,15 @@ function useNoteStream(options = {}) {
1681
1640
  result.sort((a, b) => a.firstSeenAt - b.firstSeenAt);
1682
1641
  return result;
1683
1642
  }, [allNotes, noteFirstSeen, excludeIdSet, sender, since, handledVersion]);
1684
- const latest = (0, import_react8.useMemo)(
1643
+ const latest = useMemo6(
1685
1644
  () => streamedNotes.length > 0 ? streamedNotes[streamedNotes.length - 1] : null,
1686
1645
  [streamedNotes]
1687
1646
  );
1688
- const markHandled = (0, import_react8.useCallback)((noteId) => {
1647
+ const markHandled = useCallback6((noteId) => {
1689
1648
  handledIdsRef.current = new Set(handledIdsRef.current).add(noteId);
1690
1649
  setHandledVersion((v) => v + 1);
1691
1650
  }, []);
1692
- const markAllHandled = (0, import_react8.useCallback)(() => {
1651
+ const markAllHandled = useCallback6(() => {
1693
1652
  const newSet = new Set(handledIdsRef.current);
1694
1653
  for (const note of streamedNotes) {
1695
1654
  newSet.add(note.id);
@@ -1697,7 +1656,7 @@ function useNoteStream(options = {}) {
1697
1656
  handledIdsRef.current = newSet;
1698
1657
  setHandledVersion((v) => v + 1);
1699
1658
  }, [streamedNotes]);
1700
- const snapshot = (0, import_react8.useCallback)(() => {
1659
+ const snapshot = useCallback6(() => {
1701
1660
  const ids = /* @__PURE__ */ new Set();
1702
1661
  for (const note of streamedNotes) {
1703
1662
  ids.add(note.id);
@@ -1753,20 +1712,20 @@ function buildStreamedNote(record, noteFirstSeen) {
1753
1712
  }
1754
1713
 
1755
1714
  // src/hooks/useTransactionHistory.ts
1756
- var import_react9 = require("react");
1757
- var import_lazy12 = require("@miden-sdk/miden-sdk/lazy");
1715
+ import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useState as useState6 } from "react";
1716
+ import { TransactionFilter as TransactionFilter2 } from "@miden-sdk/miden-sdk/mt";
1758
1717
  function useTransactionHistory(options = {}) {
1759
1718
  const { client, isReady } = useMiden();
1760
1719
  const { lastSyncTime } = useSyncStateStore();
1761
- const [records, setRecords] = (0, import_react9.useState)([]);
1762
- const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
1763
- const [error, setError] = (0, import_react9.useState)(null);
1764
- const rawIds = (0, import_react9.useMemo)(() => {
1720
+ const [records, setRecords] = useState6([]);
1721
+ const [isLoading, setIsLoading] = useState6(false);
1722
+ const [error, setError] = useState6(null);
1723
+ const rawIds = useMemo7(() => {
1765
1724
  if (options.id) return [options.id];
1766
1725
  if (options.ids && options.ids.length > 0) return options.ids;
1767
1726
  return null;
1768
1727
  }, [options.id, options.ids]);
1769
- const idsHex = (0, import_react9.useMemo)(() => {
1728
+ const idsHex = useMemo7(() => {
1770
1729
  if (!rawIds) return null;
1771
1730
  return rawIds.map(
1772
1731
  (id) => normalizeHex2(typeof id === "string" ? id : id.toHex())
@@ -1774,7 +1733,7 @@ function useTransactionHistory(options = {}) {
1774
1733
  }, [rawIds]);
1775
1734
  const filter = options.filter;
1776
1735
  const refreshOnSync = options.refreshOnSync !== false;
1777
- const refetch = (0, import_react9.useCallback)(async () => {
1736
+ const refetch = useCallback7(async () => {
1778
1737
  if (!client || !isReady) return;
1779
1738
  setIsLoading(true);
1780
1739
  setError(null);
@@ -1795,19 +1754,19 @@ function useTransactionHistory(options = {}) {
1795
1754
  setIsLoading(false);
1796
1755
  }
1797
1756
  }, [client, isReady, filter, rawIds, idsHex]);
1798
- (0, import_react9.useEffect)(() => {
1757
+ useEffect8(() => {
1799
1758
  if (!isReady) return;
1800
1759
  refetch();
1801
1760
  }, [isReady, refetch]);
1802
- (0, import_react9.useEffect)(() => {
1761
+ useEffect8(() => {
1803
1762
  if (!isReady || !refreshOnSync || !lastSyncTime) return;
1804
1763
  refetch();
1805
1764
  }, [isReady, lastSyncTime, refreshOnSync, refetch]);
1806
- const record = (0, import_react9.useMemo)(() => {
1765
+ const record = useMemo7(() => {
1807
1766
  if (!idsHex || idsHex.length !== 1) return null;
1808
1767
  return records.find((item) => normalizeHex2(item.id().toHex()) === idsHex[0]) ?? null;
1809
1768
  }, [records, idsHex]);
1810
- const status = (0, import_react9.useMemo)(() => {
1769
+ const status = useMemo7(() => {
1811
1770
  if (!record) return null;
1812
1771
  const current = record.transactionStatus();
1813
1772
  if (current.isCommitted()) return "committed";
@@ -1829,14 +1788,15 @@ function buildFilter(filter, ids, idsHex) {
1829
1788
  return { filter };
1830
1789
  }
1831
1790
  if (!ids || ids.length === 0) {
1832
- return { filter: import_lazy12.TransactionFilter.all() };
1791
+ return { filter: TransactionFilter2.all() };
1833
1792
  }
1834
1793
  const allTransactionIds = ids.every((id) => typeof id !== "string");
1835
1794
  if (allTransactionIds) {
1836
- return { filter: import_lazy12.TransactionFilter.ids(ids) };
1795
+ return { filter: TransactionFilter2.ids(ids) };
1837
1796
  }
1838
1797
  return {
1839
- filter: import_lazy12.TransactionFilter.all(),
1798
+ filter: TransactionFilter2.all(),
1799
+ /* v8 ignore next 1 — idsHex is always non-null when ids is non-empty; ?? [] is a safety net */
1840
1800
  localFilterHexes: idsHex ?? []
1841
1801
  };
1842
1802
  }
@@ -1847,11 +1807,11 @@ function normalizeHex2(value) {
1847
1807
  }
1848
1808
 
1849
1809
  // src/hooks/useSyncState.ts
1850
- var import_react10 = require("react");
1810
+ import { useCallback as useCallback8 } from "react";
1851
1811
  function useSyncState() {
1852
1812
  const { sync: triggerSync } = useMiden();
1853
1813
  const syncState = useSyncStateStore();
1854
- const sync = (0, import_react10.useCallback)(async () => {
1814
+ const sync = useCallback8(async () => {
1855
1815
  await triggerSync();
1856
1816
  }, [triggerSync]);
1857
1817
  return {
@@ -1861,8 +1821,11 @@ function useSyncState() {
1861
1821
  }
1862
1822
 
1863
1823
  // src/hooks/useCreateWallet.ts
1864
- var import_react11 = require("react");
1865
- var import_lazy13 = require("@miden-sdk/miden-sdk/lazy");
1824
+ import { useCallback as useCallback9, useState as useState7 } from "react";
1825
+ import {
1826
+ AccountStorageMode,
1827
+ resolveAuthScheme
1828
+ } from "@miden-sdk/miden-sdk/mt";
1866
1829
 
1867
1830
  // src/utils/runExclusive.ts
1868
1831
  var runExclusiveDirect = async (fn) => fn();
@@ -1872,10 +1835,10 @@ function useCreateWallet() {
1872
1835
  const { client, isReady, runExclusive } = useMiden();
1873
1836
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
1874
1837
  const setAccounts = useMidenStore((state) => state.setAccounts);
1875
- const [wallet, setWallet] = (0, import_react11.useState)(null);
1876
- const [isCreating, setIsCreating] = (0, import_react11.useState)(false);
1877
- const [error, setError] = (0, import_react11.useState)(null);
1878
- const createWallet = (0, import_react11.useCallback)(
1838
+ const [wallet, setWallet] = useState7(null);
1839
+ const [isCreating, setIsCreating] = useState7(false);
1840
+ const [error, setError] = useState7(null);
1841
+ const createWallet = useCallback9(
1879
1842
  async (options = {}) => {
1880
1843
  if (!client || !isReady) {
1881
1844
  throw new Error("Miden client is not ready");
@@ -1887,7 +1850,7 @@ function useCreateWallet() {
1887
1850
  options.storageMode ?? DEFAULTS.STORAGE_MODE
1888
1851
  );
1889
1852
  const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
1890
- const authScheme = (0, import_lazy13.resolveAuthScheme)(
1853
+ const authScheme = resolveAuthScheme(
1891
1854
  options.authScheme ?? DEFAULTS.AUTH_SCHEME
1892
1855
  );
1893
1856
  const newWallet = await runExclusiveSafe(async () => {
@@ -1914,7 +1877,7 @@ function useCreateWallet() {
1914
1877
  },
1915
1878
  [client, isReady, runExclusive, setAccounts]
1916
1879
  );
1917
- const reset = (0, import_react11.useCallback)(() => {
1880
+ const reset = useCallback9(() => {
1918
1881
  setWallet(null);
1919
1882
  setIsCreating(false);
1920
1883
  setError(null);
@@ -1930,27 +1893,30 @@ function useCreateWallet() {
1930
1893
  function getStorageMode(mode) {
1931
1894
  switch (mode) {
1932
1895
  case "private":
1933
- return import_lazy13.AccountStorageMode.private();
1896
+ return AccountStorageMode.private();
1934
1897
  case "public":
1935
- return import_lazy13.AccountStorageMode.public();
1898
+ return AccountStorageMode.public();
1936
1899
  case "network":
1937
- return import_lazy13.AccountStorageMode.network();
1900
+ return AccountStorageMode.network();
1938
1901
  default:
1939
- return import_lazy13.AccountStorageMode.private();
1902
+ return AccountStorageMode.private();
1940
1903
  }
1941
1904
  }
1942
1905
 
1943
1906
  // src/hooks/useCreateFaucet.ts
1944
- var import_react12 = require("react");
1945
- var import_lazy14 = require("@miden-sdk/miden-sdk/lazy");
1907
+ import { useCallback as useCallback10, useState as useState8 } from "react";
1908
+ import {
1909
+ AccountStorageMode as AccountStorageMode2,
1910
+ resolveAuthScheme as resolveAuthScheme2
1911
+ } from "@miden-sdk/miden-sdk/mt";
1946
1912
  function useCreateFaucet() {
1947
1913
  const { client, isReady, runExclusive } = useMiden();
1948
1914
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
1949
1915
  const setAccounts = useMidenStore((state) => state.setAccounts);
1950
- const [faucet, setFaucet] = (0, import_react12.useState)(null);
1951
- const [isCreating, setIsCreating] = (0, import_react12.useState)(false);
1952
- const [error, setError] = (0, import_react12.useState)(null);
1953
- const createFaucet = (0, import_react12.useCallback)(
1916
+ const [faucet, setFaucet] = useState8(null);
1917
+ const [isCreating, setIsCreating] = useState8(false);
1918
+ const [error, setError] = useState8(null);
1919
+ const createFaucet = useCallback10(
1954
1920
  async (options) => {
1955
1921
  if (!client || !isReady) {
1956
1922
  throw new Error("Miden client is not ready");
@@ -1962,7 +1928,7 @@ function useCreateFaucet() {
1962
1928
  options.storageMode ?? DEFAULTS.STORAGE_MODE
1963
1929
  );
1964
1930
  const decimals = options.decimals ?? DEFAULTS.FAUCET_DECIMALS;
1965
- const authScheme = (0, import_lazy14.resolveAuthScheme)(
1931
+ const authScheme = resolveAuthScheme2(
1966
1932
  options.authScheme ?? DEFAULTS.AUTH_SCHEME
1967
1933
  );
1968
1934
  const newFaucet = await runExclusiveSafe(async () => {
@@ -1991,7 +1957,7 @@ function useCreateFaucet() {
1991
1957
  },
1992
1958
  [client, isReady, runExclusive, setAccounts]
1993
1959
  );
1994
- const reset = (0, import_react12.useCallback)(() => {
1960
+ const reset = useCallback10(() => {
1995
1961
  setFaucet(null);
1996
1962
  setIsCreating(false);
1997
1963
  setError(null);
@@ -2007,19 +1973,19 @@ function useCreateFaucet() {
2007
1973
  function getStorageMode2(mode) {
2008
1974
  switch (mode) {
2009
1975
  case "private":
2010
- return import_lazy14.AccountStorageMode.private();
1976
+ return AccountStorageMode2.private();
2011
1977
  case "public":
2012
- return import_lazy14.AccountStorageMode.public();
1978
+ return AccountStorageMode2.public();
2013
1979
  case "network":
2014
- return import_lazy14.AccountStorageMode.network();
1980
+ return AccountStorageMode2.network();
2015
1981
  default:
2016
- return import_lazy14.AccountStorageMode.private();
1982
+ return AccountStorageMode2.private();
2017
1983
  }
2018
1984
  }
2019
1985
 
2020
1986
  // src/hooks/useImportAccount.ts
2021
- var import_react13 = require("react");
2022
- var import_lazy15 = require("@miden-sdk/miden-sdk/lazy");
1987
+ import { useCallback as useCallback11, useState as useState9 } from "react";
1988
+ import { AccountFile, resolveAuthScheme as resolveAuthScheme3 } from "@miden-sdk/miden-sdk/mt";
2023
1989
 
2024
1990
  // src/utils/errors.ts
2025
1991
  var MidenError = class extends Error {
@@ -2077,10 +2043,10 @@ function wrapWasmError(e) {
2077
2043
  function useImportAccount() {
2078
2044
  const { client, isReady, signerConnected } = useMiden();
2079
2045
  const setAccounts = useMidenStore((state) => state.setAccounts);
2080
- const [account, setAccount] = (0, import_react13.useState)(null);
2081
- const [isImporting, setIsImporting] = (0, import_react13.useState)(false);
2082
- const [error, setError] = (0, import_react13.useState)(null);
2083
- const importAccount = (0, import_react13.useCallback)(
2046
+ const [account, setAccount] = useState9(null);
2047
+ const [isImporting, setIsImporting] = useState9(false);
2048
+ const [error, setError] = useState9(null);
2049
+ const importAccount = useCallback11(
2084
2050
  async (options) => {
2085
2051
  if (!client || !isReady) {
2086
2052
  throw new Error("Miden client is not ready");
@@ -2152,7 +2118,7 @@ function useImportAccount() {
2152
2118
  }
2153
2119
  case "seed": {
2154
2120
  const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
2155
- const authScheme = (0, import_lazy15.resolveAuthScheme)(
2121
+ const authScheme = resolveAuthScheme3(
2156
2122
  options.authScheme ?? DEFAULTS.AUTH_SCHEME
2157
2123
  );
2158
2124
  return await client.importPublicAccountFromSeed(
@@ -2178,7 +2144,7 @@ function useImportAccount() {
2178
2144
  },
2179
2145
  [client, isReady, setAccounts, signerConnected]
2180
2146
  );
2181
- const reset = (0, import_react13.useCallback)(() => {
2147
+ const reset = useCallback11(() => {
2182
2148
  setAccount(null);
2183
2149
  setIsImporting(false);
2184
2150
  setError(null);
@@ -2193,10 +2159,10 @@ function useImportAccount() {
2193
2159
  }
2194
2160
  async function resolveAccountFile(file) {
2195
2161
  if (file instanceof Uint8Array) {
2196
- return import_lazy15.AccountFile.deserialize(file);
2162
+ return AccountFile.deserialize(file);
2197
2163
  }
2198
2164
  if (file instanceof ArrayBuffer) {
2199
- return import_lazy15.AccountFile.deserialize(new Uint8Array(file));
2165
+ return AccountFile.deserialize(new Uint8Array(file));
2200
2166
  }
2201
2167
  return file;
2202
2168
  }
@@ -2225,17 +2191,25 @@ function bytesEqual(left, right) {
2225
2191
  }
2226
2192
 
2227
2193
  // src/hooks/useSend.ts
2228
- var import_react14 = require("react");
2229
- var import_lazy16 = require("@miden-sdk/miden-sdk/lazy");
2194
+ import { useCallback as useCallback12, useRef as useRef4, useState as useState10 } from "react";
2195
+ import {
2196
+ FungibleAsset,
2197
+ Note,
2198
+ NoteAssets,
2199
+ NoteAttachment as NoteAttachment2,
2200
+ NoteType as NoteType2,
2201
+ NoteArray,
2202
+ TransactionRequestBuilder
2203
+ } from "@miden-sdk/miden-sdk/mt";
2230
2204
  function useSend() {
2231
2205
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2232
2206
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2233
- const isBusyRef = (0, import_react14.useRef)(false);
2234
- const [result, setResult] = (0, import_react14.useState)(null);
2235
- const [isLoading, setIsLoading] = (0, import_react14.useState)(false);
2236
- const [stage, setStage] = (0, import_react14.useState)("idle");
2237
- const [error, setError] = (0, import_react14.useState)(null);
2238
- const send = (0, import_react14.useCallback)(
2207
+ const isBusyRef = useRef4(false);
2208
+ const [result, setResult] = useState10(null);
2209
+ const [isLoading, setIsLoading] = useState10(false);
2210
+ const [stage, setStage] = useState10("idle");
2211
+ const [error, setError] = useState10(null);
2212
+ const send = useCallback12(
2239
2213
  async (options) => {
2240
2214
  if (!client || !isReady) {
2241
2215
  throw new Error("Miden client is not ready");
@@ -2293,26 +2267,26 @@ function useSend() {
2293
2267
  const fromId = parseAccountId(options.from);
2294
2268
  const toId = parseAccountId(options.to);
2295
2269
  const assetObj = parseAccountId(assetId);
2296
- const assets = new import_lazy16.NoteAssets([
2297
- new import_lazy16.FungibleAsset(assetObj, BigInt(amount))
2270
+ const assets = new NoteAssets([
2271
+ new FungibleAsset(assetObj, BigInt(amount))
2298
2272
  ]);
2299
- const p2idNote = import_lazy16.Note.createP2IDNote(
2273
+ const p2idNote = Note.createP2IDNote(
2300
2274
  fromId,
2301
2275
  toId,
2302
2276
  assets,
2303
2277
  noteType,
2304
- new import_lazy16.NoteAttachment()
2278
+ new NoteAttachment2()
2305
2279
  );
2306
- const ownOutputs = new import_lazy16.NoteArray();
2280
+ const ownOutputs = new NoteArray();
2307
2281
  ownOutputs.push(p2idNote);
2308
- const txRequest = new import_lazy16.TransactionRequestBuilder().withOwnOutputNotes(ownOutputs).build();
2282
+ const txRequest = new TransactionRequestBuilder().withOwnOutputNotes(ownOutputs).build();
2309
2283
  const execFromId = parseAccountId(options.from);
2310
2284
  const txId = prover ? await client.submitNewTransactionWithProver(
2311
2285
  execFromId,
2312
2286
  txRequest,
2313
2287
  prover
2314
2288
  ) : await client.submitNewTransaction(execFromId, txRequest);
2315
- return { txId: txId.toString(), note: p2idNote };
2289
+ return { txId: txId.toHex(), note: p2idNote };
2316
2290
  });
2317
2291
  setStage("complete");
2318
2292
  setResult(returnResult);
@@ -2326,17 +2300,17 @@ function useSend() {
2326
2300
  let txRequest;
2327
2301
  if (hasAttachment) {
2328
2302
  const attachment = createNoteAttachment(options.attachment);
2329
- const assets = new import_lazy16.NoteAssets([
2330
- new import_lazy16.FungibleAsset(assetIdObj, amount)
2303
+ const assets = new NoteAssets([
2304
+ new FungibleAsset(assetIdObj, amount)
2331
2305
  ]);
2332
- const note = import_lazy16.Note.createP2IDNote(
2306
+ const note = Note.createP2IDNote(
2333
2307
  fromAccountId,
2334
2308
  toAccountId,
2335
2309
  assets,
2336
2310
  noteType,
2337
2311
  attachment
2338
2312
  );
2339
- txRequest = new import_lazy16.TransactionRequestBuilder().withOwnOutputNotes(new import_lazy16.NoteArray([note])).build();
2313
+ txRequest = new TransactionRequestBuilder().withOwnOutputNotes(new NoteArray([note])).build();
2340
2314
  } else {
2341
2315
  txRequest = client.newSendTransactionRequest(
2342
2316
  fromAccountId,
@@ -2364,15 +2338,14 @@ function useSend() {
2364
2338
  () => client.submitProvenTransaction(provenTransaction, txResult)
2365
2339
  );
2366
2340
  const txIdHex = txResult.id().toHex();
2367
- const txIdString = txResult.id().toString();
2368
2341
  let fullNote = null;
2369
- if (noteType === import_lazy16.NoteType.Private) {
2342
+ if (noteType === NoteType2.Private) {
2370
2343
  fullNote = extractFullNote(txResult);
2371
2344
  }
2372
2345
  await runExclusiveSafe(
2373
2346
  () => client.applyTransaction(txResult, submissionHeight)
2374
2347
  );
2375
- if (noteType === import_lazy16.NoteType.Private) {
2348
+ if (noteType === NoteType2.Private) {
2376
2349
  if (!fullNote) {
2377
2350
  throw new Error("Missing full note for private send");
2378
2351
  }
@@ -2388,7 +2361,7 @@ function useSend() {
2388
2361
  );
2389
2362
  }
2390
2363
  const sendResult = {
2391
- txId: txIdString,
2364
+ txId: txIdHex,
2392
2365
  note: null
2393
2366
  };
2394
2367
  setStage("complete");
@@ -2407,7 +2380,7 @@ function useSend() {
2407
2380
  },
2408
2381
  [client, isReady, prover, runExclusive, sync]
2409
2382
  );
2410
- const reset = (0, import_react14.useCallback)(() => {
2383
+ const reset = useCallback12(() => {
2411
2384
  setResult(null);
2412
2385
  setIsLoading(false);
2413
2386
  setStage("idle");
@@ -2434,16 +2407,24 @@ function extractFullNote(txResult) {
2434
2407
  }
2435
2408
 
2436
2409
  // src/hooks/useMultiSend.ts
2437
- var import_react15 = require("react");
2438
- var import_lazy17 = require("@miden-sdk/miden-sdk/lazy");
2410
+ import { useCallback as useCallback13, useRef as useRef5, useState as useState11 } from "react";
2411
+ import {
2412
+ FungibleAsset as FungibleAsset2,
2413
+ Note as Note2,
2414
+ NoteAssets as NoteAssets2,
2415
+ NoteAttachment as NoteAttachment3,
2416
+ NoteType as NoteType3,
2417
+ NoteArray as NoteArray2,
2418
+ TransactionRequestBuilder as TransactionRequestBuilder2
2419
+ } from "@miden-sdk/miden-sdk/mt";
2439
2420
  function useMultiSend() {
2440
2421
  const { client, isReady, sync, prover, signerConnected } = useMiden();
2441
- const isBusyRef = (0, import_react15.useRef)(false);
2442
- const [result, setResult] = (0, import_react15.useState)(null);
2443
- const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
2444
- const [stage, setStage] = (0, import_react15.useState)("idle");
2445
- const [error, setError] = (0, import_react15.useState)(null);
2446
- const sendMany = (0, import_react15.useCallback)(
2422
+ const isBusyRef = useRef5(false);
2423
+ const [result, setResult] = useState11(null);
2424
+ const [isLoading, setIsLoading] = useState11(false);
2425
+ const [stage, setStage] = useState11("idle");
2426
+ const [error, setError] = useState11(null);
2427
+ const sendMany = useCallback13(
2447
2428
  async (options) => {
2448
2429
  if (!client || !isReady) {
2449
2430
  throw new Error("Miden client is not ready");
@@ -2472,12 +2453,12 @@ function useMultiSend() {
2472
2453
  const iterSenderId = parseAccountId(options.from);
2473
2454
  const iterAssetId = parseAccountId(options.assetId);
2474
2455
  const receiverId = parseAccountId(to);
2475
- const assets = new import_lazy17.NoteAssets([
2476
- new import_lazy17.FungibleAsset(iterAssetId, BigInt(amount))
2456
+ const assets = new NoteAssets2([
2457
+ new FungibleAsset2(iterAssetId, BigInt(amount))
2477
2458
  ]);
2478
2459
  const resolvedNoteType = recipientNoteType ? getNoteType(recipientNoteType) : noteType;
2479
- const noteAttachment = attachment !== void 0 && attachment !== null ? createNoteAttachment(attachment) : new import_lazy17.NoteAttachment();
2480
- const note = import_lazy17.Note.createP2IDNote(
2460
+ const noteAttachment = attachment !== void 0 && attachment !== null ? createNoteAttachment(attachment) : new NoteAttachment3();
2461
+ const note = Note2.createP2IDNote(
2481
2462
  iterSenderId,
2482
2463
  receiverId,
2483
2464
  assets,
@@ -2492,7 +2473,11 @@ function useMultiSend() {
2492
2473
  };
2493
2474
  }
2494
2475
  );
2495
- const txRequest = new import_lazy17.TransactionRequestBuilder().withOwnOutputNotes(new import_lazy17.NoteArray(outputs.map((o) => o.note))).build();
2476
+ const ownOutputs = new NoteArray2();
2477
+ for (const o of outputs) {
2478
+ ownOutputs.push(o.note);
2479
+ }
2480
+ const txRequest = new TransactionRequestBuilder2().withOwnOutputNotes(ownOutputs).build();
2496
2481
  const txSenderId = parseAccountId(options.from);
2497
2482
  const txResult = await client.executeTransaction(txSenderId, txRequest);
2498
2483
  setStage("proving");
@@ -2509,9 +2494,8 @@ function useMultiSend() {
2509
2494
  txResult
2510
2495
  );
2511
2496
  const txIdHex = txResult.id().toHex();
2512
- const txIdString = txResult.id().toString();
2513
2497
  await client.applyTransaction(txResult, submissionHeight);
2514
- const hasPrivate = outputs.some((o) => o.noteType === import_lazy17.NoteType.Private);
2498
+ const hasPrivate = outputs.some((o) => o.noteType === NoteType3.Private);
2515
2499
  if (hasPrivate) {
2516
2500
  await waitForTransactionCommit(
2517
2501
  client,
@@ -2519,7 +2503,7 @@ function useMultiSend() {
2519
2503
  txIdHex
2520
2504
  );
2521
2505
  for (const output of outputs) {
2522
- if (output.noteType === import_lazy17.NoteType.Private) {
2506
+ if (output.noteType === NoteType3.Private) {
2523
2507
  await client.sendPrivateNote(
2524
2508
  output.note,
2525
2509
  output.recipientAddress
@@ -2527,7 +2511,7 @@ function useMultiSend() {
2527
2511
  }
2528
2512
  }
2529
2513
  }
2530
- const txSummary = { transactionId: txIdString };
2514
+ const txSummary = { transactionId: txIdHex };
2531
2515
  setStage("complete");
2532
2516
  setResult(txSummary);
2533
2517
  await sync();
@@ -2544,7 +2528,7 @@ function useMultiSend() {
2544
2528
  },
2545
2529
  [client, isReady, prover, signerConnected, sync]
2546
2530
  );
2547
- const reset = (0, import_react15.useCallback)(() => {
2531
+ const reset = useCallback13(() => {
2548
2532
  setResult(null);
2549
2533
  setIsLoading(false);
2550
2534
  setStage("idle");
@@ -2561,11 +2545,11 @@ function useMultiSend() {
2561
2545
  }
2562
2546
 
2563
2547
  // src/hooks/useWaitForCommit.ts
2564
- var import_react16 = require("react");
2565
- var import_lazy18 = require("@miden-sdk/miden-sdk/lazy");
2548
+ import { useCallback as useCallback14 } from "react";
2549
+ import { TransactionFilter as TransactionFilter3 } from "@miden-sdk/miden-sdk/mt";
2566
2550
  function useWaitForCommit() {
2567
2551
  const { client, isReady } = useMiden();
2568
- const waitForCommit = (0, import_react16.useCallback)(
2552
+ const waitForCommit = useCallback14(
2569
2553
  async (txId, options) => {
2570
2554
  if (!client || !isReady) {
2571
2555
  throw new Error("Miden client is not ready");
@@ -2579,7 +2563,7 @@ function useWaitForCommit() {
2579
2563
  while (Date.now() < deadline) {
2580
2564
  await client.syncState();
2581
2565
  const records = await client.getTransactions(
2582
- typeof txId === "string" ? import_lazy18.TransactionFilter.all() : import_lazy18.TransactionFilter.ids([txId])
2566
+ typeof txId === "string" ? TransactionFilter3.all() : TransactionFilter3.ids([txId])
2583
2567
  );
2584
2568
  const record = records.find(
2585
2569
  (item) => normalizeHex3(item.id().toHex()) === targetHex
@@ -2608,11 +2592,11 @@ function normalizeHex3(value) {
2608
2592
  }
2609
2593
 
2610
2594
  // src/hooks/useWaitForNotes.ts
2611
- var import_react17 = require("react");
2595
+ import { useCallback as useCallback15 } from "react";
2612
2596
  function useWaitForNotes() {
2613
2597
  const { client, isReady, runExclusive } = useMiden();
2614
2598
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2615
- const waitForConsumableNotes = (0, import_react17.useCallback)(
2599
+ const waitForConsumableNotes = useCallback15(
2616
2600
  async (options) => {
2617
2601
  if (!client || !isReady) {
2618
2602
  throw new Error("Miden client is not ready");
@@ -2643,15 +2627,15 @@ function useWaitForNotes() {
2643
2627
  }
2644
2628
 
2645
2629
  // src/hooks/useMint.ts
2646
- var import_react18 = require("react");
2630
+ import { useCallback as useCallback16, useState as useState12 } from "react";
2647
2631
  function useMint() {
2648
2632
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2649
2633
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2650
- const [result, setResult] = (0, import_react18.useState)(null);
2651
- const [isLoading, setIsLoading] = (0, import_react18.useState)(false);
2652
- const [stage, setStage] = (0, import_react18.useState)("idle");
2653
- const [error, setError] = (0, import_react18.useState)(null);
2654
- const mint = (0, import_react18.useCallback)(
2634
+ const [result, setResult] = useState12(null);
2635
+ const [isLoading, setIsLoading] = useState12(false);
2636
+ const [stage, setStage] = useState12("idle");
2637
+ const [error, setError] = useState12(null);
2638
+ const mint = useCallback16(
2655
2639
  async (options) => {
2656
2640
  if (!client || !isReady) {
2657
2641
  throw new Error("Miden client is not ready");
@@ -2676,7 +2660,7 @@ function useMint() {
2676
2660
  txRequest,
2677
2661
  prover
2678
2662
  ) : await client.submitNewTransaction(faucetIdObj, txRequest);
2679
- return { transactionId: txId.toString() };
2663
+ return { transactionId: txId.toHex() };
2680
2664
  });
2681
2665
  setStage("complete");
2682
2666
  setResult(txResult);
@@ -2693,7 +2677,7 @@ function useMint() {
2693
2677
  },
2694
2678
  [client, isReady, prover, runExclusive, sync]
2695
2679
  );
2696
- const reset = (0, import_react18.useCallback)(() => {
2680
+ const reset = useCallback16(() => {
2697
2681
  setResult(null);
2698
2682
  setIsLoading(false);
2699
2683
  setStage("idle");
@@ -2710,16 +2694,16 @@ function useMint() {
2710
2694
  }
2711
2695
 
2712
2696
  // src/hooks/useConsume.ts
2713
- var import_react19 = require("react");
2714
- var import_lazy19 = require("@miden-sdk/miden-sdk/lazy");
2697
+ import { useCallback as useCallback17, useState as useState13 } from "react";
2698
+ import { NoteFilter as NoteFilter3, NoteFilterTypes as NoteFilterTypes2, NoteId } from "@miden-sdk/miden-sdk/mt";
2715
2699
  function useConsume() {
2716
2700
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2717
2701
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2718
- const [result, setResult] = (0, import_react19.useState)(null);
2719
- const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
2720
- const [stage, setStage] = (0, import_react19.useState)("idle");
2721
- const [error, setError] = (0, import_react19.useState)(null);
2722
- const consume = (0, import_react19.useCallback)(
2702
+ const [result, setResult] = useState13(null);
2703
+ const [isLoading, setIsLoading] = useState13(false);
2704
+ const [stage, setStage] = useState13("idle");
2705
+ const [error, setError] = useState13(null);
2706
+ const consume = useCallback17(
2723
2707
  async (options) => {
2724
2708
  if (!client || !isReady) {
2725
2709
  throw new Error("Miden client is not ready");
@@ -2741,7 +2725,7 @@ function useConsume() {
2741
2725
  const item = options.notes[i];
2742
2726
  if (typeof item === "string") {
2743
2727
  lookupIndices.push(i);
2744
- lookupIds.push(import_lazy19.NoteId.fromHex(item));
2728
+ lookupIds.push(NoteId.fromHex(item));
2745
2729
  } else if (item !== null && typeof item === "object" && typeof item.toNote === "function") {
2746
2730
  resolved[i] = item.toNote();
2747
2731
  } else if (item !== null && typeof item === "object" && typeof item.id === "function") {
@@ -2752,16 +2736,17 @@ function useConsume() {
2752
2736
  }
2753
2737
  }
2754
2738
  if (lookupIds.length > 0) {
2755
- const filter = new import_lazy19.NoteFilter(import_lazy19.NoteFilterTypes.List, lookupIds);
2739
+ const lookupIdStrings = lookupIds.map((id) => id.toString());
2740
+ const filter = new NoteFilter3(NoteFilterTypes2.List, lookupIds);
2756
2741
  const noteRecords = await client.getInputNotes(filter);
2757
- if (noteRecords.length !== lookupIds.length) {
2742
+ if (noteRecords.length !== lookupIdStrings.length) {
2758
2743
  throw new Error("Some notes could not be found for provided IDs");
2759
2744
  }
2760
2745
  const recordById = new Map(
2761
2746
  noteRecords.map((r) => [r.id().toString(), r])
2762
2747
  );
2763
2748
  for (let j = 0; j < lookupIndices.length; j++) {
2764
- const record = recordById.get(lookupIds[j].toString());
2749
+ const record = recordById.get(lookupIdStrings[j]);
2765
2750
  if (!record) {
2766
2751
  throw new Error(
2767
2752
  "Some notes could not be found for provided IDs"
@@ -2783,7 +2768,7 @@ function useConsume() {
2783
2768
  txRequest,
2784
2769
  prover
2785
2770
  ) : await client.submitNewTransaction(accountIdObj, txRequest);
2786
- return { transactionId: txId.toString() };
2771
+ return { transactionId: txId.toHex() };
2787
2772
  });
2788
2773
  setStage("complete");
2789
2774
  setResult(txResult);
@@ -2800,7 +2785,7 @@ function useConsume() {
2800
2785
  },
2801
2786
  [client, isReady, prover, runExclusive, sync]
2802
2787
  );
2803
- const reset = (0, import_react19.useCallback)(() => {
2788
+ const reset = useCallback17(() => {
2804
2789
  setResult(null);
2805
2790
  setIsLoading(false);
2806
2791
  setStage("idle");
@@ -2817,15 +2802,15 @@ function useConsume() {
2817
2802
  }
2818
2803
 
2819
2804
  // src/hooks/useSwap.ts
2820
- var import_react20 = require("react");
2805
+ import { useCallback as useCallback18, useState as useState14 } from "react";
2821
2806
  function useSwap() {
2822
2807
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2823
2808
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2824
- const [result, setResult] = (0, import_react20.useState)(null);
2825
- const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
2826
- const [stage, setStage] = (0, import_react20.useState)("idle");
2827
- const [error, setError] = (0, import_react20.useState)(null);
2828
- const swap = (0, import_react20.useCallback)(
2809
+ const [result, setResult] = useState14(null);
2810
+ const [isLoading, setIsLoading] = useState14(false);
2811
+ const [stage, setStage] = useState14("idle");
2812
+ const [error, setError] = useState14(null);
2813
+ const swap = useCallback18(
2829
2814
  async (options) => {
2830
2815
  if (!client || !isReady) {
2831
2816
  throw new Error("Miden client is not ready");
@@ -2857,7 +2842,7 @@ function useSwap() {
2857
2842
  txRequest,
2858
2843
  prover
2859
2844
  ) : await client.submitNewTransaction(accountIdObj, txRequest);
2860
- return { transactionId: txId.toString() };
2845
+ return { transactionId: txId.toHex() };
2861
2846
  });
2862
2847
  setStage("complete");
2863
2848
  setResult(txResult);
@@ -2874,7 +2859,7 @@ function useSwap() {
2874
2859
  },
2875
2860
  [client, isReady, prover, runExclusive, sync]
2876
2861
  );
2877
- const reset = (0, import_react20.useCallback)(() => {
2862
+ const reset = useCallback18(() => {
2878
2863
  setResult(null);
2879
2864
  setIsLoading(false);
2880
2865
  setStage("idle");
@@ -2891,16 +2876,16 @@ function useSwap() {
2891
2876
  }
2892
2877
 
2893
2878
  // src/hooks/useTransaction.ts
2894
- var import_react21 = require("react");
2879
+ import { useCallback as useCallback19, useRef as useRef6, useState as useState15 } from "react";
2895
2880
 
2896
2881
  // src/utils/transactions.ts
2897
- var import_lazy20 = require("@miden-sdk/miden-sdk/lazy");
2882
+ import { NoteType as NoteType4, TransactionFilter as TransactionFilter4 } from "@miden-sdk/miden-sdk/mt";
2898
2883
  async function waitForTransactionCommit2(client, runExclusiveSafe, txId, maxWaitMs = 1e4, delayMs = 1e3) {
2899
2884
  let waited = 0;
2900
2885
  while (waited < maxWaitMs) {
2901
2886
  await runExclusiveSafe(() => client.syncState());
2902
2887
  const [record] = await runExclusiveSafe(
2903
- () => client.getTransactions(import_lazy20.TransactionFilter.ids([txId]))
2888
+ () => client.getTransactions(TransactionFilter4.ids([txId]))
2904
2889
  );
2905
2890
  if (record) {
2906
2891
  const status = record.transactionStatus();
@@ -2922,7 +2907,7 @@ function extractFullNotes(txResult) {
2922
2907
  const notes = executedTx?.outputNotes?.().notes?.() ?? [];
2923
2908
  const result = [];
2924
2909
  for (const note of notes) {
2925
- if (note.noteType?.() === import_lazy20.NoteType.Private) {
2910
+ if (note.noteType?.() === NoteType4.Private) {
2926
2911
  const full = note.intoFull?.();
2927
2912
  if (full) result.push(full);
2928
2913
  }
@@ -2937,12 +2922,12 @@ function extractFullNotes(txResult) {
2937
2922
  function useTransaction() {
2938
2923
  const { client, isReady, sync, runExclusive } = useMiden();
2939
2924
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2940
- const isBusyRef = (0, import_react21.useRef)(false);
2941
- const [result, setResult] = (0, import_react21.useState)(null);
2942
- const [isLoading, setIsLoading] = (0, import_react21.useState)(false);
2943
- const [stage, setStage] = (0, import_react21.useState)("idle");
2944
- const [error, setError] = (0, import_react21.useState)(null);
2945
- const execute = (0, import_react21.useCallback)(
2925
+ const isBusyRef = useRef6(false);
2926
+ const [result, setResult] = useState15(null);
2927
+ const [isLoading, setIsLoading] = useState15(false);
2928
+ const [stage, setStage] = useState15("idle");
2929
+ const [error, setError] = useState15(null);
2930
+ const execute = useCallback19(
2946
2931
  async (options) => {
2947
2932
  if (!client || !isReady) {
2948
2933
  throw new Error("Miden client is not ready");
@@ -2992,7 +2977,7 @@ function useTransaction() {
2992
2977
  );
2993
2978
  }
2994
2979
  }
2995
- const txSummary = { transactionId: txId.toString() };
2980
+ const txSummary = { transactionId: txId.toHex() };
2996
2981
  setStage("complete");
2997
2982
  setResult(txSummary);
2998
2983
  await sync();
@@ -3009,7 +2994,7 @@ function useTransaction() {
3009
2994
  },
3010
2995
  [client, isReady, runExclusive, sync]
3011
2996
  );
3012
- const reset = (0, import_react21.useCallback)(() => {
2997
+ const reset = useCallback19(() => {
3013
2998
  setResult(null);
3014
2999
  setIsLoading(false);
3015
3000
  setStage("idle");
@@ -3032,19 +3017,24 @@ async function resolveRequest(request, client) {
3032
3017
  }
3033
3018
 
3034
3019
  // src/hooks/useExecuteProgram.ts
3035
- var import_react22 = require("react");
3036
- var import_lazy21 = require("@miden-sdk/miden-sdk/lazy");
3020
+ import { useCallback as useCallback20, useRef as useRef7, useState as useState16 } from "react";
3021
+ import {
3022
+ AdviceInputs,
3023
+ ForeignAccount,
3024
+ ForeignAccountArray,
3025
+ AccountStorageRequirements
3026
+ } from "@miden-sdk/miden-sdk/mt";
3037
3027
  function isForeignAccountWrapper(fa) {
3038
3028
  return fa !== null && typeof fa === "object" && "id" in fa && typeof fa.id !== "function";
3039
3029
  }
3040
3030
  function useExecuteProgram() {
3041
3031
  const { client, isReady, sync, runExclusive } = useMiden();
3042
3032
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3043
- const isBusyRef = (0, import_react22.useRef)(false);
3044
- const [result, setResult] = (0, import_react22.useState)(null);
3045
- const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
3046
- const [error, setError] = (0, import_react22.useState)(null);
3047
- const execute = (0, import_react22.useCallback)(
3033
+ const isBusyRef = useRef7(false);
3034
+ const [result, setResult] = useState16(null);
3035
+ const [isLoading, setIsLoading] = useState16(false);
3036
+ const [error, setError] = useState16(null);
3037
+ const execute = useCallback20(
3048
3038
  async (options) => {
3049
3039
  if (!client || !isReady) {
3050
3040
  throw new Error("Miden client is not ready");
@@ -3064,18 +3054,18 @@ function useExecuteProgram() {
3064
3054
  }
3065
3055
  const programResult = await runExclusiveSafe(async () => {
3066
3056
  const accountIdObj = parseAccountId(options.accountId);
3067
- const adviceInputs = options.adviceInputs ?? new import_lazy21.AdviceInputs();
3057
+ const adviceInputs = options.adviceInputs ?? new AdviceInputs();
3068
3058
  let foreignAccountsArray;
3069
3059
  if (options.foreignAccounts?.length) {
3070
3060
  const accounts = options.foreignAccounts.map((fa) => {
3071
3061
  const wrapper = isForeignAccountWrapper(fa);
3072
3062
  const id = parseAccountId(wrapper ? fa.id : fa);
3073
- const storage = wrapper && fa.storage ? fa.storage : new import_lazy21.AccountStorageRequirements();
3074
- return import_lazy21.ForeignAccount.public(id, storage);
3063
+ const storage = wrapper && fa.storage ? fa.storage : new AccountStorageRequirements();
3064
+ return ForeignAccount.public(id, storage);
3075
3065
  });
3076
- foreignAccountsArray = new import_lazy21.ForeignAccountArray(accounts);
3066
+ foreignAccountsArray = new ForeignAccountArray(accounts);
3077
3067
  } else {
3078
- foreignAccountsArray = new import_lazy21.ForeignAccountArray();
3068
+ foreignAccountsArray = new ForeignAccountArray();
3079
3069
  }
3080
3070
  const feltArray = await client.executeProgram(
3081
3071
  accountIdObj,
@@ -3103,7 +3093,7 @@ function useExecuteProgram() {
3103
3093
  },
3104
3094
  [client, isReady, runExclusive, sync]
3105
3095
  );
3106
- const reset = (0, import_react22.useCallback)(() => {
3096
+ const reset = useCallback20(() => {
3107
3097
  setResult(null);
3108
3098
  setIsLoading(false);
3109
3099
  setError(null);
@@ -3118,29 +3108,29 @@ function useExecuteProgram() {
3118
3108
  }
3119
3109
 
3120
3110
  // src/hooks/useCompile.ts
3121
- var import_react23 = require("react");
3122
- var import_lazy22 = require("@miden-sdk/miden-sdk/lazy");
3111
+ import { useCallback as useCallback21, useMemo as useMemo8 } from "react";
3112
+ import { CompilerResource, getWasmOrThrow } from "@miden-sdk/miden-sdk/mt";
3123
3113
  function useCompile() {
3124
3114
  const { client, isReady } = useMiden();
3125
- const resource = (0, import_react23.useMemo)(
3126
- () => client && isReady ? new import_lazy22.CompilerResource(client, import_lazy22.getWasmOrThrow) : null,
3115
+ const resource = useMemo8(
3116
+ () => client && isReady ? new CompilerResource(client, getWasmOrThrow) : null,
3127
3117
  [client, isReady]
3128
3118
  );
3129
- const requireResource = (0, import_react23.useCallback)(() => {
3119
+ const requireResource = useCallback21(() => {
3130
3120
  if (!resource) {
3131
3121
  throw new Error("Miden client is not ready");
3132
3122
  }
3133
3123
  return resource;
3134
3124
  }, [resource]);
3135
- const component = (0, import_react23.useCallback)(
3125
+ const component = useCallback21(
3136
3126
  async (options) => requireResource().component(options),
3137
3127
  [requireResource]
3138
3128
  );
3139
- const txScript = (0, import_react23.useCallback)(
3129
+ const txScript = useCallback21(
3140
3130
  async (options) => requireResource().txScript(options),
3141
3131
  [requireResource]
3142
3132
  );
3143
- const noteScript = (0, import_react23.useCallback)(
3133
+ const noteScript = useCallback21(
3144
3134
  async (options) => requireResource().noteScript(options),
3145
3135
  [requireResource]
3146
3136
  );
@@ -3148,27 +3138,30 @@ function useCompile() {
3148
3138
  }
3149
3139
 
3150
3140
  // src/hooks/useSessionAccount.ts
3151
- var import_react24 = require("react");
3152
- var import_lazy23 = require("@miden-sdk/miden-sdk/lazy");
3141
+ import { useCallback as useCallback22, useEffect as useEffect9, useRef as useRef8, useState as useState17 } from "react";
3142
+ import {
3143
+ AccountStorageMode as AccountStorageMode3,
3144
+ resolveAuthScheme as resolveAuthScheme4
3145
+ } from "@miden-sdk/miden-sdk/mt";
3153
3146
  function useSessionAccount(options) {
3154
3147
  const { client, isReady, sync } = useMiden();
3155
3148
  const setAccounts = useMidenStore((state) => state.setAccounts);
3156
- const [sessionAccountId, setSessionAccountId] = (0, import_react24.useState)(null);
3157
- const [step, setStep] = (0, import_react24.useState)("idle");
3158
- const [error, setError] = (0, import_react24.useState)(null);
3159
- const cancelledRef = (0, import_react24.useRef)(false);
3160
- const isBusyRef = (0, import_react24.useRef)(false);
3149
+ const [sessionAccountId, setSessionAccountId] = useState17(null);
3150
+ const [step, setStep] = useState17("idle");
3151
+ const [error, setError] = useState17(null);
3152
+ const cancelledRef = useRef8(false);
3153
+ const isBusyRef = useRef8(false);
3161
3154
  const storagePrefix = options.storagePrefix ?? "miden-session";
3162
3155
  const pollIntervalMs = options.pollIntervalMs ?? 3e3;
3163
3156
  const maxWaitMs = options.maxWaitMs ?? 6e4;
3164
3157
  const storageMode = options.walletOptions?.storageMode ?? "public";
3165
3158
  const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
3166
- const authScheme = (0, import_lazy23.resolveAuthScheme)(
3159
+ const authScheme = resolveAuthScheme4(
3167
3160
  options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME
3168
3161
  );
3169
- const fundRef = (0, import_react24.useRef)(options.fund);
3162
+ const fundRef = useRef8(options.fund);
3170
3163
  fundRef.current = options.fund;
3171
- (0, import_react24.useEffect)(() => {
3164
+ useEffect9(() => {
3172
3165
  try {
3173
3166
  const stored = localStorage.getItem(`${storagePrefix}:accountId`);
3174
3167
  const storedReady = localStorage.getItem(`${storagePrefix}:ready`);
@@ -3185,7 +3178,7 @@ function useSessionAccount(options) {
3185
3178
  localStorage.removeItem(`${storagePrefix}:ready`);
3186
3179
  }
3187
3180
  }, [storagePrefix]);
3188
- const initialize = (0, import_react24.useCallback)(async () => {
3181
+ const initialize = useCallback22(async () => {
3189
3182
  if (!client || !isReady) {
3190
3183
  throw new Error("Miden client is not ready");
3191
3184
  }
@@ -3216,13 +3209,14 @@ function useSessionAccount(options) {
3216
3209
  setSessionAccountId(walletId);
3217
3210
  localStorage.setItem(`${storagePrefix}:accountId`, walletId);
3218
3211
  }
3212
+ const resolvedWalletId = walletId;
3219
3213
  setStep("funding");
3220
- await fundRef.current(walletId);
3214
+ await fundRef.current(resolvedWalletId);
3221
3215
  if (cancelledRef.current) return;
3222
3216
  setStep("consuming");
3223
3217
  await waitAndConsume(
3224
3218
  client,
3225
- walletId,
3219
+ resolvedWalletId,
3226
3220
  pollIntervalMs,
3227
3221
  maxWaitMs,
3228
3222
  cancelledRef
@@ -3254,7 +3248,7 @@ function useSessionAccount(options) {
3254
3248
  maxWaitMs,
3255
3249
  setAccounts
3256
3250
  ]);
3257
- const reset = (0, import_react24.useCallback)(() => {
3251
+ const reset = useCallback22(() => {
3258
3252
  cancelledRef.current = true;
3259
3253
  isBusyRef.current = false;
3260
3254
  setSessionAccountId(null);
@@ -3275,11 +3269,11 @@ function useSessionAccount(options) {
3275
3269
  function getStorageMode3(mode) {
3276
3270
  switch (mode) {
3277
3271
  case "private":
3278
- return import_lazy23.AccountStorageMode.private();
3272
+ return AccountStorageMode3.private();
3279
3273
  case "public":
3280
- return import_lazy23.AccountStorageMode.public();
3274
+ return AccountStorageMode3.public();
3281
3275
  default:
3282
- return import_lazy23.AccountStorageMode.public();
3276
+ return AccountStorageMode3.public();
3283
3277
  }
3284
3278
  }
3285
3279
  async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cancelledRef) {
@@ -3303,13 +3297,13 @@ async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cance
3303
3297
  }
3304
3298
 
3305
3299
  // src/hooks/useExportStore.ts
3306
- var import_react25 = require("react");
3307
- var import_lazy24 = require("@miden-sdk/miden-sdk/lazy");
3300
+ import { useCallback as useCallback23, useState as useState18 } from "react";
3301
+ import { exportStore as sdkExportStore } from "@miden-sdk/miden-sdk/mt";
3308
3302
  function useExportStore() {
3309
3303
  const { client, isReady, runExclusive } = useMiden();
3310
- const [isExporting, setIsExporting] = (0, import_react25.useState)(false);
3311
- const [error, setError] = (0, import_react25.useState)(null);
3312
- const exportStore = (0, import_react25.useCallback)(async () => {
3304
+ const [isExporting, setIsExporting] = useState18(false);
3305
+ const [error, setError] = useState18(null);
3306
+ const exportStore = useCallback23(async () => {
3313
3307
  if (!client || !isReady) {
3314
3308
  throw new Error("Miden client is not ready");
3315
3309
  }
@@ -3317,7 +3311,7 @@ function useExportStore() {
3317
3311
  setError(null);
3318
3312
  try {
3319
3313
  const storeName = client.storeIdentifier();
3320
- const snapshot = await runExclusive(() => (0, import_lazy24.exportStore)(storeName));
3314
+ const snapshot = await runExclusive(() => sdkExportStore(storeName));
3321
3315
  return snapshot;
3322
3316
  } catch (err) {
3323
3317
  const error2 = err instanceof Error ? err : new Error(String(err));
@@ -3327,7 +3321,7 @@ function useExportStore() {
3327
3321
  setIsExporting(false);
3328
3322
  }
3329
3323
  }, [client, isReady, runExclusive]);
3330
- const reset = (0, import_react25.useCallback)(() => {
3324
+ const reset = useCallback23(() => {
3331
3325
  setIsExporting(false);
3332
3326
  setError(null);
3333
3327
  }, []);
@@ -3340,13 +3334,13 @@ function useExportStore() {
3340
3334
  }
3341
3335
 
3342
3336
  // src/hooks/useImportStore.ts
3343
- var import_react26 = require("react");
3344
- var import_lazy25 = require("@miden-sdk/miden-sdk/lazy");
3337
+ import { useCallback as useCallback24, useState as useState19 } from "react";
3338
+ import { importStore as sdkImportStore } from "@miden-sdk/miden-sdk/mt";
3345
3339
  function useImportStore() {
3346
3340
  const { client, isReady, runExclusive, sync } = useMiden();
3347
- const [isImporting, setIsImporting] = (0, import_react26.useState)(false);
3348
- const [error, setError] = (0, import_react26.useState)(null);
3349
- const importStore = (0, import_react26.useCallback)(
3341
+ const [isImporting, setIsImporting] = useState19(false);
3342
+ const [error, setError] = useState19(null);
3343
+ const importStore = useCallback24(
3350
3344
  async (storeDump, storeName, options) => {
3351
3345
  if (!client || !isReady) {
3352
3346
  throw new Error("Miden client is not ready");
@@ -3354,7 +3348,7 @@ function useImportStore() {
3354
3348
  setIsImporting(true);
3355
3349
  setError(null);
3356
3350
  try {
3357
- await runExclusive(() => (0, import_lazy25.importStore)(storeName, storeDump));
3351
+ await runExclusive(() => sdkImportStore(storeName, storeDump));
3358
3352
  if (!options?.skipSync) {
3359
3353
  await sync();
3360
3354
  }
@@ -3368,7 +3362,7 @@ function useImportStore() {
3368
3362
  },
3369
3363
  [client, isReady, runExclusive, sync]
3370
3364
  );
3371
- const reset = (0, import_react26.useCallback)(() => {
3365
+ const reset = useCallback24(() => {
3372
3366
  setIsImporting(false);
3373
3367
  setError(null);
3374
3368
  }, []);
@@ -3381,13 +3375,13 @@ function useImportStore() {
3381
3375
  }
3382
3376
 
3383
3377
  // src/hooks/useImportNote.ts
3384
- var import_react27 = require("react");
3385
- var import_lazy26 = require("@miden-sdk/miden-sdk/lazy");
3378
+ import { useCallback as useCallback25, useState as useState20 } from "react";
3379
+ import { NoteFile } from "@miden-sdk/miden-sdk/mt";
3386
3380
  function useImportNote() {
3387
3381
  const { client, isReady, runExclusive, sync } = useMiden();
3388
- const [isImporting, setIsImporting] = (0, import_react27.useState)(false);
3389
- const [error, setError] = (0, import_react27.useState)(null);
3390
- const importNote = (0, import_react27.useCallback)(
3382
+ const [isImporting, setIsImporting] = useState20(false);
3383
+ const [error, setError] = useState20(null);
3384
+ const importNote = useCallback25(
3391
3385
  async (noteBytes) => {
3392
3386
  if (!client || !isReady) {
3393
3387
  throw new Error("Miden client is not ready");
@@ -3395,7 +3389,7 @@ function useImportNote() {
3395
3389
  setIsImporting(true);
3396
3390
  setError(null);
3397
3391
  try {
3398
- const noteFile = import_lazy26.NoteFile.deserialize(noteBytes);
3392
+ const noteFile = NoteFile.deserialize(noteBytes);
3399
3393
  const noteId = await runExclusive(
3400
3394
  () => client.importNoteFile(noteFile)
3401
3395
  );
@@ -3411,7 +3405,7 @@ function useImportNote() {
3411
3405
  },
3412
3406
  [client, isReady, runExclusive, sync]
3413
3407
  );
3414
- const reset = (0, import_react27.useCallback)(() => {
3408
+ const reset = useCallback25(() => {
3415
3409
  setIsImporting(false);
3416
3410
  setError(null);
3417
3411
  }, []);
@@ -3424,13 +3418,13 @@ function useImportNote() {
3424
3418
  }
3425
3419
 
3426
3420
  // src/hooks/useExportNote.ts
3427
- var import_react28 = require("react");
3428
- var import_lazy27 = require("@miden-sdk/miden-sdk/lazy");
3421
+ import { useCallback as useCallback26, useState as useState21 } from "react";
3422
+ import { NoteExportFormat } from "@miden-sdk/miden-sdk/mt";
3429
3423
  function useExportNote() {
3430
3424
  const { client, isReady, runExclusive } = useMiden();
3431
- const [isExporting, setIsExporting] = (0, import_react28.useState)(false);
3432
- const [error, setError] = (0, import_react28.useState)(null);
3433
- const exportNote = (0, import_react28.useCallback)(
3425
+ const [isExporting, setIsExporting] = useState21(false);
3426
+ const [error, setError] = useState21(null);
3427
+ const exportNote = useCallback26(
3434
3428
  async (noteId) => {
3435
3429
  if (!client || !isReady) {
3436
3430
  throw new Error("Miden client is not ready");
@@ -3439,7 +3433,7 @@ function useExportNote() {
3439
3433
  setError(null);
3440
3434
  try {
3441
3435
  const noteFile = await runExclusive(
3442
- () => client.exportNoteFile(noteId, import_lazy27.NoteExportFormat.Full)
3436
+ () => client.exportNoteFile(noteId, NoteExportFormat.Full)
3443
3437
  );
3444
3438
  return noteFile.serialize();
3445
3439
  } catch (err) {
@@ -3452,7 +3446,7 @@ function useExportNote() {
3452
3446
  },
3453
3447
  [client, isReady, runExclusive]
3454
3448
  );
3455
- const reset = (0, import_react28.useCallback)(() => {
3449
+ const reset = useCallback26(() => {
3456
3450
  setIsExporting(false);
3457
3451
  setError(null);
3458
3452
  }, []);
@@ -3465,12 +3459,12 @@ function useExportNote() {
3465
3459
  }
3466
3460
 
3467
3461
  // src/hooks/useSyncControl.ts
3468
- var import_react29 = require("react");
3462
+ import { useCallback as useCallback27 } from "react";
3469
3463
  function useSyncControl() {
3470
3464
  const isPaused = useMidenStore((state) => state.syncPaused);
3471
3465
  const setSyncPaused = useMidenStore((state) => state.setSyncPaused);
3472
- const pauseSync = (0, import_react29.useCallback)(() => setSyncPaused(true), [setSyncPaused]);
3473
- const resumeSync = (0, import_react29.useCallback)(() => setSyncPaused(false), [setSyncPaused]);
3466
+ const pauseSync = useCallback27(() => setSyncPaused(true), [setSyncPaused]);
3467
+ const resumeSync = useCallback27(() => setSyncPaused(false), [setSyncPaused]);
3474
3468
  return {
3475
3469
  pauseSync,
3476
3470
  resumeSync,
@@ -3627,8 +3621,7 @@ function createMidenStorage(prefix) {
3627
3621
 
3628
3622
  // src/index.ts
3629
3623
  installAccountBech32();
3630
- // Annotate the CommonJS export names for ESM import in node:
3631
- 0 && (module.exports = {
3624
+ export {
3632
3625
  AuthScheme,
3633
3626
  DEFAULTS,
3634
3627
  MidenError,
@@ -3683,4 +3676,4 @@ installAccountBech32();
3683
3676
  useWaitForNotes,
3684
3677
  waitForWalletDetection,
3685
3678
  wrapWasmError
3686
- });
3679
+ };