@miden-sdk/react 0.15.3 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mt.mjs CHANGED
@@ -2761,17 +2761,92 @@ function useMint() {
2761
2761
  };
2762
2762
  }
2763
2763
 
2764
- // src/hooks/useConsume.ts
2764
+ // src/hooks/useBridge.ts
2765
2765
  import { useCallback as useCallback20, useState as useState16 } from "react";
2766
- import { NoteFilter as NoteFilter3, NoteFilterTypes as NoteFilterTypes2, NoteId } from "@miden-sdk/miden-sdk/mt";
2767
- function useConsume() {
2766
+ import { EthAddress } from "@miden-sdk/miden-sdk/mt";
2767
+ function useBridge() {
2768
2768
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2769
2769
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2770
2770
  const [result, setResult] = useState16(null);
2771
2771
  const [isLoading, setIsLoading] = useState16(false);
2772
2772
  const [stage, setStage] = useState16("idle");
2773
2773
  const [error, setError] = useState16(null);
2774
- const consume = useCallback20(
2774
+ const bridge = useCallback20(
2775
+ async (options) => {
2776
+ if (!client || !isReady) {
2777
+ throw new Error("Miden client is not ready");
2778
+ }
2779
+ setIsLoading(true);
2780
+ setStage("executing");
2781
+ setError(null);
2782
+ try {
2783
+ const senderId = parseAccountId(options.from);
2784
+ const bridgeId = parseAccountId(options.bridgeAccount);
2785
+ const assetId = parseAccountId(options.assetId);
2786
+ const destinationAddress = EthAddress.fromHex(
2787
+ options.destinationAddress
2788
+ );
2789
+ setStage("proving");
2790
+ const txResult = await runExclusiveSafe(async () => {
2791
+ const txRequest = await client.newB2AggTransactionRequest(
2792
+ senderId,
2793
+ bridgeId,
2794
+ assetId,
2795
+ BigInt(options.amount),
2796
+ options.destinationNetwork,
2797
+ destinationAddress
2798
+ );
2799
+ const txId = prover ? await client.submitNewTransactionWithProver(
2800
+ senderId,
2801
+ txRequest,
2802
+ prover
2803
+ ) : await client.submitNewTransaction(senderId, txRequest);
2804
+ return { transactionId: txId.toHex() };
2805
+ });
2806
+ setStage("complete");
2807
+ setResult(txResult);
2808
+ if (!options.skipSync) {
2809
+ await sync();
2810
+ }
2811
+ return txResult;
2812
+ } catch (err) {
2813
+ const error2 = err instanceof Error ? err : new Error(String(err));
2814
+ setError(error2);
2815
+ setStage("idle");
2816
+ throw error2;
2817
+ } finally {
2818
+ setIsLoading(false);
2819
+ }
2820
+ },
2821
+ [client, isReady, prover, runExclusive, sync]
2822
+ );
2823
+ const reset = useCallback20(() => {
2824
+ setResult(null);
2825
+ setIsLoading(false);
2826
+ setStage("idle");
2827
+ setError(null);
2828
+ }, []);
2829
+ return {
2830
+ bridge,
2831
+ result,
2832
+ isLoading,
2833
+ stage,
2834
+ error,
2835
+ reset
2836
+ };
2837
+ }
2838
+
2839
+ // src/hooks/useConsume.ts
2840
+ import { useCallback as useCallback21, useState as useState17 } from "react";
2841
+ import { NoteFilter as NoteFilter3, NoteFilterTypes as NoteFilterTypes2, NoteId } from "@miden-sdk/miden-sdk/mt";
2842
+ function useConsume() {
2843
+ const { client, isReady, sync, runExclusive, prover } = useMiden();
2844
+ const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2845
+ const [result, setResult] = useState17(null);
2846
+ const [isLoading, setIsLoading] = useState17(false);
2847
+ const [stage, setStage] = useState17("idle");
2848
+ const [error, setError] = useState17(null);
2849
+ const consume = useCallback21(
2775
2850
  async (options) => {
2776
2851
  if (!client || !isReady) {
2777
2852
  throw new Error("Miden client is not ready");
@@ -2855,7 +2930,7 @@ function useConsume() {
2855
2930
  },
2856
2931
  [client, isReady, prover, runExclusive, sync]
2857
2932
  );
2858
- const reset = useCallback20(() => {
2933
+ const reset = useCallback21(() => {
2859
2934
  setResult(null);
2860
2935
  setIsLoading(false);
2861
2936
  setStage("idle");
@@ -2872,15 +2947,15 @@ function useConsume() {
2872
2947
  }
2873
2948
 
2874
2949
  // src/hooks/useSwap.ts
2875
- import { useCallback as useCallback21, useState as useState17 } from "react";
2950
+ import { useCallback as useCallback22, useState as useState18 } from "react";
2876
2951
  function useSwap() {
2877
2952
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2878
2953
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2879
- const [result, setResult] = useState17(null);
2880
- const [isLoading, setIsLoading] = useState17(false);
2881
- const [stage, setStage] = useState17("idle");
2882
- const [error, setError] = useState17(null);
2883
- const swap = useCallback21(
2954
+ const [result, setResult] = useState18(null);
2955
+ const [isLoading, setIsLoading] = useState18(false);
2956
+ const [stage, setStage] = useState18("idle");
2957
+ const [error, setError] = useState18(null);
2958
+ const swap = useCallback22(
2884
2959
  async (options) => {
2885
2960
  if (!client || !isReady) {
2886
2961
  throw new Error("Miden client is not ready");
@@ -2929,7 +3004,7 @@ function useSwap() {
2929
3004
  },
2930
3005
  [client, isReady, prover, runExclusive, sync]
2931
3006
  );
2932
- const reset = useCallback21(() => {
3007
+ const reset = useCallback22(() => {
2933
3008
  setResult(null);
2934
3009
  setIsLoading(false);
2935
3010
  setStage("idle");
@@ -2946,15 +3021,15 @@ function useSwap() {
2946
3021
  }
2947
3022
 
2948
3023
  // src/hooks/usePswapCreate.ts
2949
- import { useCallback as useCallback22, useState as useState18 } from "react";
3024
+ import { useCallback as useCallback23, useState as useState19 } from "react";
2950
3025
  function usePswapCreate() {
2951
3026
  const { client, isReady, sync, runExclusive, prover } = useMiden();
2952
3027
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
2953
- const [result, setResult] = useState18(null);
2954
- const [isLoading, setIsLoading] = useState18(false);
2955
- const [stage, setStage] = useState18("idle");
2956
- const [error, setError] = useState18(null);
2957
- const pswapCreate = useCallback22(
3028
+ const [result, setResult] = useState19(null);
3029
+ const [isLoading, setIsLoading] = useState19(false);
3030
+ const [stage, setStage] = useState19("idle");
3031
+ const [error, setError] = useState19(null);
3032
+ const pswapCreate = useCallback23(
2958
3033
  async (options) => {
2959
3034
  if (!client || !isReady) {
2960
3035
  throw new Error("Miden client is not ready");
@@ -3011,7 +3086,7 @@ function usePswapCreate() {
3011
3086
  },
3012
3087
  [client, isReady, prover, runExclusive, sync]
3013
3088
  );
3014
- const reset = useCallback22(() => {
3089
+ const reset = useCallback23(() => {
3015
3090
  setResult(null);
3016
3091
  setIsLoading(false);
3017
3092
  setStage("idle");
@@ -3028,15 +3103,15 @@ function usePswapCreate() {
3028
3103
  }
3029
3104
 
3030
3105
  // src/hooks/usePswapConsume.ts
3031
- import { useCallback as useCallback23, useState as useState19 } from "react";
3106
+ import { useCallback as useCallback24, useState as useState20 } from "react";
3032
3107
  function usePswapConsume() {
3033
3108
  const { client, isReady, sync, runExclusive, prover } = useMiden();
3034
3109
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3035
- const [result, setResult] = useState19(null);
3036
- const [isLoading, setIsLoading] = useState19(false);
3037
- const [stage, setStage] = useState19("idle");
3038
- const [error, setError] = useState19(null);
3039
- const pswapConsume = useCallback23(
3110
+ const [result, setResult] = useState20(null);
3111
+ const [isLoading, setIsLoading] = useState20(false);
3112
+ const [stage, setStage] = useState20("idle");
3113
+ const [error, setError] = useState20(null);
3114
+ const pswapConsume = useCallback24(
3040
3115
  async (options) => {
3041
3116
  if (!client || !isReady) {
3042
3117
  throw new Error("Miden client is not ready");
@@ -3085,7 +3160,7 @@ function usePswapConsume() {
3085
3160
  },
3086
3161
  [client, isReady, prover, runExclusive, sync]
3087
3162
  );
3088
- const reset = useCallback23(() => {
3163
+ const reset = useCallback24(() => {
3089
3164
  setResult(null);
3090
3165
  setIsLoading(false);
3091
3166
  setStage("idle");
@@ -3102,15 +3177,15 @@ function usePswapConsume() {
3102
3177
  }
3103
3178
 
3104
3179
  // src/hooks/usePswapCancel.ts
3105
- import { useCallback as useCallback24, useState as useState20 } from "react";
3180
+ import { useCallback as useCallback25, useState as useState21 } from "react";
3106
3181
  function usePswapCancel() {
3107
3182
  const { client, isReady, sync, runExclusive, prover } = useMiden();
3108
3183
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3109
- const [result, setResult] = useState20(null);
3110
- const [isLoading, setIsLoading] = useState20(false);
3111
- const [stage, setStage] = useState20("idle");
3112
- const [error, setError] = useState20(null);
3113
- const pswapCancel = useCallback24(
3184
+ const [result, setResult] = useState21(null);
3185
+ const [isLoading, setIsLoading] = useState21(false);
3186
+ const [stage, setStage] = useState21("idle");
3187
+ const [error, setError] = useState21(null);
3188
+ const pswapCancel = useCallback25(
3114
3189
  async (options) => {
3115
3190
  if (!client || !isReady) {
3116
3191
  throw new Error("Miden client is not ready");
@@ -3149,7 +3224,7 @@ function usePswapCancel() {
3149
3224
  },
3150
3225
  [client, isReady, prover, runExclusive, sync]
3151
3226
  );
3152
- const reset = useCallback24(() => {
3227
+ const reset = useCallback25(() => {
3153
3228
  setResult(null);
3154
3229
  setIsLoading(false);
3155
3230
  setStage("idle");
@@ -3166,15 +3241,15 @@ function usePswapCancel() {
3166
3241
  }
3167
3242
 
3168
3243
  // src/hooks/usePswapCancelByOrder.ts
3169
- import { useCallback as useCallback25, useState as useState21 } from "react";
3244
+ import { useCallback as useCallback26, useState as useState22 } from "react";
3170
3245
  function usePswapCancelByOrder() {
3171
3246
  const { client, isReady, sync, runExclusive, prover } = useMiden();
3172
3247
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3173
- const [result, setResult] = useState21(null);
3174
- const [isLoading, setIsLoading] = useState21(false);
3175
- const [stage, setStage] = useState21("idle");
3176
- const [error, setError] = useState21(null);
3177
- const pswapCancelByOrder = useCallback25(
3248
+ const [result, setResult] = useState22(null);
3249
+ const [isLoading, setIsLoading] = useState22(false);
3250
+ const [stage, setStage] = useState22("idle");
3251
+ const [error, setError] = useState22(null);
3252
+ const pswapCancelByOrder = useCallback26(
3178
3253
  async (options) => {
3179
3254
  if (!client || !isReady) {
3180
3255
  throw new Error("Miden client is not ready");
@@ -3214,7 +3289,7 @@ function usePswapCancelByOrder() {
3214
3289
  },
3215
3290
  [client, isReady, prover, runExclusive, sync]
3216
3291
  );
3217
- const reset = useCallback25(() => {
3292
+ const reset = useCallback26(() => {
3218
3293
  setResult(null);
3219
3294
  setIsLoading(false);
3220
3295
  setStage("idle");
@@ -3230,11 +3305,124 @@ function usePswapCancelByOrder() {
3230
3305
  };
3231
3306
  }
3232
3307
 
3308
+ // src/hooks/useCreateNetworkNote.ts
3309
+ import { useCallback as useCallback27, useState as useState23 } from "react";
3310
+ import {
3311
+ Felt,
3312
+ FeltArray,
3313
+ FungibleAsset as FungibleAsset3,
3314
+ Note as Note3,
3315
+ NoteArray as NoteArray3,
3316
+ NoteAssets as NoteAssets3,
3317
+ NoteMetadata,
3318
+ NoteStorage,
3319
+ NoteRecipient,
3320
+ NoteTag,
3321
+ NoteType as NoteType4,
3322
+ NetworkAccountTarget,
3323
+ TransactionRequestBuilder as TransactionRequestBuilder3
3324
+ } from "@miden-sdk/miden-sdk/mt";
3325
+ function useCreateNetworkNote() {
3326
+ const { client, isReady, sync, runExclusive, prover } = useMiden();
3327
+ const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3328
+ const [result, setResult] = useState23(null);
3329
+ const [isLoading, setIsLoading] = useState23(false);
3330
+ const [stage, setStage] = useState23("idle");
3331
+ const [error, setError] = useState23(null);
3332
+ const createNetworkNote = useCallback27(
3333
+ async (options) => {
3334
+ if (!client || !isReady) {
3335
+ throw new Error("Miden client is not ready");
3336
+ }
3337
+ if (options.recipient && options.script) {
3338
+ throw new Error(
3339
+ "createNetworkNote requires exactly one of `recipient` or `script`, not both."
3340
+ );
3341
+ }
3342
+ if (!options.recipient && !options.script) {
3343
+ throw new Error(
3344
+ "createNetworkNote requires either `recipient` or `script`."
3345
+ );
3346
+ }
3347
+ setIsLoading(true);
3348
+ setStage("executing");
3349
+ setError(null);
3350
+ try {
3351
+ const built = await runExclusiveSafe(async () => {
3352
+ const senderId = parseAccountId(options.accountId);
3353
+ const targetId = parseAccountId(options.target);
3354
+ const target = new NetworkAccountTarget(
3355
+ targetId,
3356
+ options.executionHint
3357
+ );
3358
+ const noteAssets = options.assetId != null ? new NoteAssets3([
3359
+ new FungibleAsset3(
3360
+ parseAccountId(options.assetId),
3361
+ BigInt(options.amount ?? 0)
3362
+ )
3363
+ ]) : new NoteAssets3();
3364
+ const metadata = new NoteMetadata(
3365
+ senderId,
3366
+ NoteType4.Public,
3367
+ NoteTag.withAccountTarget(target.targetId())
3368
+ );
3369
+ const recipient = options.recipient ?? NoteRecipient.fromScript(
3370
+ options.script,
3371
+ new NoteStorage(
3372
+ new FeltArray(
3373
+ (options.inputs ?? []).map((value) => new Felt(value))
3374
+ )
3375
+ )
3376
+ );
3377
+ const attachments = [target.toAttachment()];
3378
+ if (options.attachment) {
3379
+ attachments.push(createNoteAttachment(options.attachment));
3380
+ }
3381
+ const note = Note3.withAttachments(
3382
+ noteAssets,
3383
+ metadata,
3384
+ recipient,
3385
+ attachments
3386
+ );
3387
+ const ownOutputs = new NoteArray3();
3388
+ ownOutputs.push(note);
3389
+ const txRequest = new TransactionRequestBuilder3().withOwnOutputNotes(ownOutputs).build();
3390
+ const txId = prover ? await client.submitNewTransactionWithProver(
3391
+ senderId,
3392
+ txRequest,
3393
+ prover
3394
+ ) : await client.submitNewTransaction(senderId, txRequest);
3395
+ return { txId: txId.toHex(), note };
3396
+ });
3397
+ setStage("complete");
3398
+ setResult(built);
3399
+ await sync();
3400
+ return built;
3401
+ } catch (err) {
3402
+ const e = err instanceof Error ? err : new Error(String(err));
3403
+ setError(e);
3404
+ setStage("idle");
3405
+ throw e;
3406
+ } finally {
3407
+ setIsLoading(false);
3408
+ }
3409
+ },
3410
+ [client, isReady, prover, runExclusive, sync]
3411
+ );
3412
+ const reset = useCallback27(() => {
3413
+ setResult(null);
3414
+ setIsLoading(false);
3415
+ setStage("idle");
3416
+ setError(null);
3417
+ }, []);
3418
+ return { createNetworkNote, result, isLoading, stage, error, reset };
3419
+ }
3420
+
3233
3421
  // src/hooks/useTransaction.ts
3234
- import { useCallback as useCallback26, useRef as useRef9, useState as useState22 } from "react";
3422
+ import { useCallback as useCallback28, useRef as useRef9, useState as useState24 } from "react";
3235
3423
 
3236
3424
  // src/utils/transactions.ts
3237
- import { NoteType as NoteType4, TransactionFilter as TransactionFilter4 } from "@miden-sdk/miden-sdk/mt";
3425
+ import { NoteType as NoteType5, TransactionFilter as TransactionFilter4 } from "@miden-sdk/miden-sdk/mt";
3238
3426
  async function waitForTransactionCommit2(client, runExclusiveSafe, txId, maxWaitMs = 1e4, delayMs = 1e3) {
3239
3427
  let waited = 0;
3240
3428
  while (waited < maxWaitMs) {
@@ -3262,7 +3450,7 @@ function extractFullNotes(txResult) {
3262
3450
  const notes = executedTx?.outputNotes?.().notes?.() ?? [];
3263
3451
  const result = [];
3264
3452
  for (const note of notes) {
3265
- if (note.noteType?.() === NoteType4.Private) {
3453
+ if (note.noteType?.() === NoteType5.Private) {
3266
3454
  const full = note.intoFull?.();
3267
3455
  if (full) result.push(full);
3268
3456
  }
@@ -3278,11 +3466,11 @@ function useTransaction() {
3278
3466
  const { client, isReady, sync, runExclusive } = useMiden();
3279
3467
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3280
3468
  const isBusyRef = useRef9(false);
3281
- const [result, setResult] = useState22(null);
3282
- const [isLoading, setIsLoading] = useState22(false);
3283
- const [stage, setStage] = useState22("idle");
3284
- const [error, setError] = useState22(null);
3285
- const execute = useCallback26(
3469
+ const [result, setResult] = useState24(null);
3470
+ const [isLoading, setIsLoading] = useState24(false);
3471
+ const [stage, setStage] = useState24("idle");
3472
+ const [error, setError] = useState24(null);
3473
+ const execute = useCallback28(
3286
3474
  async (options) => {
3287
3475
  if (!client || !isReady) {
3288
3476
  throw new Error("Miden client is not ready");
@@ -3349,7 +3537,7 @@ function useTransaction() {
3349
3537
  },
3350
3538
  [client, isReady, runExclusive, sync]
3351
3539
  );
3352
- const reset = useCallback26(() => {
3540
+ const reset = useCallback28(() => {
3353
3541
  setResult(null);
3354
3542
  setIsLoading(false);
3355
3543
  setStage("idle");
@@ -3372,7 +3560,7 @@ async function resolveRequest(request, client) {
3372
3560
  }
3373
3561
 
3374
3562
  // src/hooks/useExecuteProgram.ts
3375
- import { useCallback as useCallback27, useRef as useRef10, useState as useState23 } from "react";
3563
+ import { useCallback as useCallback29, useRef as useRef10, useState as useState25 } from "react";
3376
3564
  import {
3377
3565
  AdviceInputs,
3378
3566
  ForeignAccount,
@@ -3386,10 +3574,10 @@ function useExecuteProgram() {
3386
3574
  const { client, isReady, sync, runExclusive } = useMiden();
3387
3575
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3388
3576
  const isBusyRef = useRef10(false);
3389
- const [result, setResult] = useState23(null);
3390
- const [isLoading, setIsLoading] = useState23(false);
3391
- const [error, setError] = useState23(null);
3392
- const execute = useCallback27(
3577
+ const [result, setResult] = useState25(null);
3578
+ const [isLoading, setIsLoading] = useState25(false);
3579
+ const [error, setError] = useState25(null);
3580
+ const execute = useCallback29(
3393
3581
  async (options) => {
3394
3582
  if (!client || !isReady) {
3395
3583
  throw new Error("Miden client is not ready");
@@ -3448,7 +3636,7 @@ function useExecuteProgram() {
3448
3636
  },
3449
3637
  [client, isReady, runExclusive, sync]
3450
3638
  );
3451
- const reset = useCallback27(() => {
3639
+ const reset = useCallback29(() => {
3452
3640
  setResult(null);
3453
3641
  setIsLoading(false);
3454
3642
  setError(null);
@@ -3463,7 +3651,7 @@ function useExecuteProgram() {
3463
3651
  }
3464
3652
 
3465
3653
  // src/hooks/useCompile.ts
3466
- import { useCallback as useCallback28, useMemo as useMemo9 } from "react";
3654
+ import { useCallback as useCallback30, useMemo as useMemo9 } from "react";
3467
3655
  import { CompilerResource, getWasmOrThrow } from "@miden-sdk/miden-sdk/mt";
3468
3656
  function useCompile() {
3469
3657
  const { client, isReady } = useMiden();
@@ -3471,21 +3659,21 @@ function useCompile() {
3471
3659
  () => client && isReady ? new CompilerResource(client, getWasmOrThrow) : null,
3472
3660
  [client, isReady]
3473
3661
  );
3474
- const requireResource = useCallback28(() => {
3662
+ const requireResource = useCallback30(() => {
3475
3663
  if (!resource) {
3476
3664
  throw new Error("Miden client is not ready");
3477
3665
  }
3478
3666
  return resource;
3479
3667
  }, [resource]);
3480
- const component = useCallback28(
3668
+ const component = useCallback30(
3481
3669
  async (options) => requireResource().component(options),
3482
3670
  [requireResource]
3483
3671
  );
3484
- const txScript = useCallback28(
3672
+ const txScript = useCallback30(
3485
3673
  async (options) => requireResource().txScript(options),
3486
3674
  [requireResource]
3487
3675
  );
3488
- const noteScript = useCallback28(
3676
+ const noteScript = useCallback30(
3489
3677
  async (options) => requireResource().noteScript(options),
3490
3678
  [requireResource]
3491
3679
  );
@@ -3493,14 +3681,14 @@ function useCompile() {
3493
3681
  }
3494
3682
 
3495
3683
  // src/hooks/useSessionAccount.ts
3496
- import { useCallback as useCallback29, useEffect as useEffect12, useRef as useRef11, useState as useState24 } from "react";
3684
+ import { useCallback as useCallback31, useEffect as useEffect12, useRef as useRef11, useState as useState26 } from "react";
3497
3685
  import { AccountStorageMode as AccountStorageMode3 } from "@miden-sdk/miden-sdk/mt";
3498
3686
  function useSessionAccount(options) {
3499
3687
  const { client, isReady, sync } = useMiden();
3500
3688
  const setAccounts = useMidenStore((state) => state.setAccounts);
3501
- const [sessionAccountId, setSessionAccountId] = useState24(null);
3502
- const [step, setStep] = useState24("idle");
3503
- const [error, setError] = useState24(null);
3689
+ const [sessionAccountId, setSessionAccountId] = useState26(null);
3690
+ const [step, setStep] = useState26("idle");
3691
+ const [error, setError] = useState26(null);
3504
3692
  const cancelledRef = useRef11(false);
3505
3693
  const isBusyRef = useRef11(false);
3506
3694
  const storagePrefix = options.storagePrefix ?? "miden-session";
@@ -3527,7 +3715,7 @@ function useSessionAccount(options) {
3527
3715
  localStorage.removeItem(`${storagePrefix}:ready`);
3528
3716
  }
3529
3717
  }, [storagePrefix]);
3530
- const initialize = useCallback29(async () => {
3718
+ const initialize = useCallback31(async () => {
3531
3719
  if (!client || !isReady) {
3532
3720
  throw new Error("Miden client is not ready");
3533
3721
  }
@@ -3591,7 +3779,7 @@ function useSessionAccount(options) {
3591
3779
  maxWaitMs,
3592
3780
  setAccounts
3593
3781
  ]);
3594
- const reset = useCallback29(() => {
3782
+ const reset = useCallback31(() => {
3595
3783
  cancelledRef.current = true;
3596
3784
  isBusyRef.current = false;
3597
3785
  setSessionAccountId(null);
@@ -3640,13 +3828,13 @@ async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cance
3640
3828
  }
3641
3829
 
3642
3830
  // src/hooks/useExportStore.ts
3643
- import { useCallback as useCallback30, useState as useState25 } from "react";
3831
+ import { useCallback as useCallback32, useState as useState27 } from "react";
3644
3832
  import { exportStore as sdkExportStore } from "@miden-sdk/miden-sdk/mt";
3645
3833
  function useExportStore() {
3646
3834
  const { client, isReady, runExclusive } = useMiden();
3647
- const [isExporting, setIsExporting] = useState25(false);
3648
- const [error, setError] = useState25(null);
3649
- const exportStore = useCallback30(async () => {
3835
+ const [isExporting, setIsExporting] = useState27(false);
3836
+ const [error, setError] = useState27(null);
3837
+ const exportStore = useCallback32(async () => {
3650
3838
  if (!client || !isReady) {
3651
3839
  throw new Error("Miden client is not ready");
3652
3840
  }
@@ -3664,7 +3852,7 @@ function useExportStore() {
3664
3852
  setIsExporting(false);
3665
3853
  }
3666
3854
  }, [client, isReady, runExclusive]);
3667
- const reset = useCallback30(() => {
3855
+ const reset = useCallback32(() => {
3668
3856
  setIsExporting(false);
3669
3857
  setError(null);
3670
3858
  }, []);
@@ -3677,13 +3865,13 @@ function useExportStore() {
3677
3865
  }
3678
3866
 
3679
3867
  // src/hooks/useImportStore.ts
3680
- import { useCallback as useCallback31, useState as useState26 } from "react";
3868
+ import { useCallback as useCallback33, useState as useState28 } from "react";
3681
3869
  import { importStore as sdkImportStore } from "@miden-sdk/miden-sdk/mt";
3682
3870
  function useImportStore() {
3683
3871
  const { client, isReady, runExclusive, sync } = useMiden();
3684
- const [isImporting, setIsImporting] = useState26(false);
3685
- const [error, setError] = useState26(null);
3686
- const importStore = useCallback31(
3872
+ const [isImporting, setIsImporting] = useState28(false);
3873
+ const [error, setError] = useState28(null);
3874
+ const importStore = useCallback33(
3687
3875
  async (storeDump, storeName, options) => {
3688
3876
  if (!client || !isReady) {
3689
3877
  throw new Error("Miden client is not ready");
@@ -3705,7 +3893,7 @@ function useImportStore() {
3705
3893
  },
3706
3894
  [client, isReady, runExclusive, sync]
3707
3895
  );
3708
- const reset = useCallback31(() => {
3896
+ const reset = useCallback33(() => {
3709
3897
  setIsImporting(false);
3710
3898
  setError(null);
3711
3899
  }, []);
@@ -3718,13 +3906,13 @@ function useImportStore() {
3718
3906
  }
3719
3907
 
3720
3908
  // src/hooks/useImportNote.ts
3721
- import { useCallback as useCallback32, useState as useState27 } from "react";
3909
+ import { useCallback as useCallback34, useState as useState29 } from "react";
3722
3910
  import { NoteFile } from "@miden-sdk/miden-sdk/mt";
3723
3911
  function useImportNote() {
3724
3912
  const { client, isReady, runExclusive, sync } = useMiden();
3725
- const [isImporting, setIsImporting] = useState27(false);
3726
- const [error, setError] = useState27(null);
3727
- const importNote = useCallback32(
3913
+ const [isImporting, setIsImporting] = useState29(false);
3914
+ const [error, setError] = useState29(null);
3915
+ const importNote = useCallback34(
3728
3916
  async (noteBytes) => {
3729
3917
  if (!client || !isReady) {
3730
3918
  throw new Error("Miden client is not ready");
@@ -3748,7 +3936,7 @@ function useImportNote() {
3748
3936
  },
3749
3937
  [client, isReady, runExclusive, sync]
3750
3938
  );
3751
- const reset = useCallback32(() => {
3939
+ const reset = useCallback34(() => {
3752
3940
  setIsImporting(false);
3753
3941
  setError(null);
3754
3942
  }, []);
@@ -3761,13 +3949,13 @@ function useImportNote() {
3761
3949
  }
3762
3950
 
3763
3951
  // src/hooks/useExportNote.ts
3764
- import { useCallback as useCallback33, useState as useState28 } from "react";
3952
+ import { useCallback as useCallback35, useState as useState30 } from "react";
3765
3953
  import { NoteExportFormat } from "@miden-sdk/miden-sdk/mt";
3766
3954
  function useExportNote() {
3767
3955
  const { client, isReady, runExclusive } = useMiden();
3768
- const [isExporting, setIsExporting] = useState28(false);
3769
- const [error, setError] = useState28(null);
3770
- const exportNote = useCallback33(
3956
+ const [isExporting, setIsExporting] = useState30(false);
3957
+ const [error, setError] = useState30(null);
3958
+ const exportNote = useCallback35(
3771
3959
  async (noteId) => {
3772
3960
  if (!client || !isReady) {
3773
3961
  throw new Error("Miden client is not ready");
@@ -3789,7 +3977,7 @@ function useExportNote() {
3789
3977
  },
3790
3978
  [client, isReady, runExclusive]
3791
3979
  );
3792
- const reset = useCallback33(() => {
3980
+ const reset = useCallback35(() => {
3793
3981
  setIsExporting(false);
3794
3982
  setError(null);
3795
3983
  }, []);
@@ -3802,12 +3990,12 @@ function useExportNote() {
3802
3990
  }
3803
3991
 
3804
3992
  // src/hooks/useSyncControl.ts
3805
- import { useCallback as useCallback34 } from "react";
3993
+ import { useCallback as useCallback36 } from "react";
3806
3994
  function useSyncControl() {
3807
3995
  const isPaused = useMidenStore((state) => state.syncPaused);
3808
3996
  const setSyncPaused = useMidenStore((state) => state.setSyncPaused);
3809
- const pauseSync = useCallback34(() => setSyncPaused(true), [setSyncPaused]);
3810
- const resumeSync = useCallback34(() => setSyncPaused(false), [setSyncPaused]);
3997
+ const pauseSync = useCallback36(() => setSyncPaused(true), [setSyncPaused]);
3998
+ const resumeSync = useCallback36(() => setSyncPaused(false), [setSyncPaused]);
3811
3999
  return {
3812
4000
  pauseSync,
3813
4001
  resumeSync,
@@ -3992,9 +4180,11 @@ export {
3992
4180
  useAccount,
3993
4181
  useAccounts,
3994
4182
  useAssetMetadata,
4183
+ useBridge,
3995
4184
  useCompile,
3996
4185
  useConsume,
3997
4186
  useCreateFaucet,
4187
+ useCreateNetworkNote,
3998
4188
  useCreateWallet,
3999
4189
  useExecuteProgram,
4000
4190
  useExportNote,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miden-sdk/react",
3
- "version": "0.15.3",
3
+ "version": "0.15.5",
4
4
  "description": "React hooks library for Miden Web Client",
5
5
  "type": "module",
6
6
  "module": "dist/index.mjs",
@@ -32,7 +32,7 @@
32
32
  "CLAUDE.md"
33
33
  ],
34
34
  "peerDependencies": {
35
- "@miden-sdk/miden-sdk": "^0.15.3",
35
+ "@miden-sdk/miden-sdk": "^0.15.5",
36
36
  "react": ">=18.0.0"
37
37
  },
38
38
  "dependencies": {
@@ -52,7 +52,7 @@
52
52
  "tsup": "^8.0.0",
53
53
  "typescript": "^5.0.0",
54
54
  "vitest": "^3.0.0",
55
- "@miden-sdk/miden-sdk": "0.15.3"
55
+ "@miden-sdk/miden-sdk": "0.15.5"
56
56
  },
57
57
  "keywords": [
58
58
  "miden",