@miden-sdk/react 0.15.3 → 0.15.4

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/CLAUDE.md CHANGED
@@ -149,6 +149,22 @@ await mint({
149
149
  });
150
150
  ```
151
151
 
152
+ ### Bridge Out (AggLayer)
153
+ ```tsx
154
+ const { bridge } = useBridge();
155
+
156
+ // Emits a public B2AGG note that the bridge account consumes, burning the
157
+ // asset so it can be claimed at the destination Ethereum address.
158
+ await bridge({
159
+ from: senderAccountId,
160
+ bridgeAccount: bridgeAccountId,
161
+ assetId: tokenFaucetId,
162
+ amount: 100n,
163
+ destinationNetwork: 1, // AggLayer-assigned network id
164
+ destinationAddress: "0x000000000000000000000000000000000000dEaD",
165
+ });
166
+ ```
167
+
152
168
  ### Create Faucet
153
169
  ```tsx
154
170
  const { createFaucet } = useCreateFaucet();
@@ -410,6 +426,7 @@ Query hooks return `{ ...data, isLoading, error, refetch }`. Mutation hooks retu
410
426
  | `useSend()` | `send({ from, to, assetId, amount, noteType })` | `SendResult` (with `txId`, `note`) |
411
427
  | `useMultiSend()` | `multiSend({ from, recipients })` | `TransactionResult` |
412
428
  | `useMint()` | `mint({ faucetId, to, amount })` | `TransactionResult` |
429
+ | `useBridge()` | `bridge({ from, bridgeAccount, assetId, amount, destinationNetwork, destinationAddress })` | `TransactionResult` (emits an AggLayer B2AGG bridge-out note) |
413
430
  | `useConsume()` | `consume({ accountId, notes })` | `TransactionResult` |
414
431
  | `useSwap()` | `swap({ ... })` | `TransactionResult` |
415
432
  | `usePswapCreate()` | `pswapCreate({ accountId, offeredFaucetId, offeredAmount, requestedFaucetId, requestedAmount, ... })` | `TransactionResult` (creates partial-swap note) |
package/README.md CHANGED
@@ -12,6 +12,7 @@ React hooks library for the Miden Web Client. Provides a simple, ergonomic inter
12
12
  - **Note Attachments** - Send and read arbitrary data payloads on notes via `useSend()` and `readNoteAttachment()`
13
13
  - **Temporal Note Tracking** - `useNoteStream()` tracks when notes first appear, with built-in filtering, handled-note exclusion, and phase snapshots
14
14
  - **Session Wallets** - `useSessionAccount()` manages the create-fund-consume lifecycle for temporary wallets
15
+ - **AggLayer Bridge-Out** - `useBridge()` emits a B2AGG note to bridge a fungible asset out to another network via the AggLayer
15
16
  - **Concurrency Safety** - Transaction hooks prevent double-sends with built-in concurrency guards
16
17
  - **Auto Pre-Sync** - Transaction hooks sync before executing by default (opt out with `skipSync`)
17
18
  - **WASM Error Wrapping** - Cryptic WASM errors are intercepted and replaced with actionable messages
package/dist/index.d.ts CHANGED
@@ -392,6 +392,22 @@ interface MintOptions {
392
392
  /** Note type. Default: private */
393
393
  noteType?: NoteVisibility;
394
394
  }
395
+ interface BridgeOptions {
396
+ /** Account that creates and funds the bridge note (the sender) */
397
+ from: AccountRef;
398
+ /** Bridge account that consumes the note and burns the bridged assets */
399
+ bridgeAccount: AccountRef;
400
+ /** Faucet/token ID of the fungible asset to bridge */
401
+ assetId: AccountRef;
402
+ /** Amount of the asset to bridge */
403
+ amount: bigint | number;
404
+ /** AggLayer-assigned network ID of the destination chain */
405
+ destinationNetwork: number;
406
+ /** Destination Ethereum address on the destination network (0x-prefixed hex) */
407
+ destinationAddress: string;
408
+ /** Skip auto-sync after bridging. Default: false */
409
+ skipSync?: boolean;
410
+ }
395
411
  interface ConsumeOptions {
396
412
  /** Account ID that will consume the notes */
397
413
  accountId: string;
@@ -1174,6 +1190,61 @@ interface UseMintResult {
1174
1190
  */
1175
1191
  declare function useMint(): UseMintResult;
1176
1192
 
1193
+ interface UseBridgeResult {
1194
+ /** Bridge a fungible asset out to another network via the AggLayer */
1195
+ bridge: (options: BridgeOptions) => Promise<TransactionResult>;
1196
+ /** The transaction result */
1197
+ result: TransactionResult | null;
1198
+ /** Whether the transaction is in progress */
1199
+ isLoading: boolean;
1200
+ /** Current stage of the transaction */
1201
+ stage: TransactionStage;
1202
+ /** Error if transaction failed */
1203
+ error: Error | null;
1204
+ /** Reset the hook state */
1205
+ reset: () => void;
1206
+ }
1207
+ /**
1208
+ * Hook to bridge a fungible asset out to another network via the AggLayer.
1209
+ *
1210
+ * Emits a single public B2AGG (Bridge-to-AggLayer) note that the bridge account consumes,
1211
+ * burning the asset so it can be claimed at the destination Ethereum address on the destination
1212
+ * network. The sender account executes the transaction that emits the note.
1213
+ *
1214
+ * Returns `{ bridge, result, isLoading, stage, error, reset }`. `bridge` resolves to a
1215
+ * `TransactionResult` (`{ transactionId }`) and rejects on failure.
1216
+ *
1217
+ * @example
1218
+ * ```tsx
1219
+ * function BridgeButton({ from, bridgeAccount, assetId }: Props) {
1220
+ * const { bridge, isLoading, stage, error } = useBridge();
1221
+ *
1222
+ * const handleBridge = async () => {
1223
+ * try {
1224
+ * const result = await bridge({
1225
+ * from,
1226
+ * bridgeAccount,
1227
+ * assetId,
1228
+ * amount: 100n,
1229
+ * destinationNetwork: 1,
1230
+ * destinationAddress: "0x000000000000000000000000000000000000dEaD",
1231
+ * });
1232
+ * console.log("Bridged! TX:", result.transactionId);
1233
+ * } catch (err) {
1234
+ * console.error("Bridge failed:", err);
1235
+ * }
1236
+ * };
1237
+ *
1238
+ * return (
1239
+ * <button onClick={handleBridge} disabled={isLoading}>
1240
+ * {isLoading ? stage : "Bridge"}
1241
+ * </button>
1242
+ * );
1243
+ * }
1244
+ * ```
1245
+ */
1246
+ declare function useBridge(): UseBridgeResult;
1247
+
1177
1248
  interface UseConsumeResult {
1178
1249
  /** Consume one or more notes */
1179
1250
  consume: (options: ConsumeOptions) => Promise<TransactionResult>;
@@ -1840,4 +1911,4 @@ declare function createMidenStorage(prefix: string): {
1840
1911
  clear(): void;
1841
1912
  };
1842
1913
 
1843
- export { type AccountRef, type AccountResult, type AccountsResult, type AssetBalance, type AssetMetadata, type ConsumeOptions, type CreateFaucetOptions, type CreateWalletOptions, DEFAULTS, type ExecuteProgramOptions, type ExecuteProgramResult, type ExecuteTransactionOptions, type ImportAccountOptions, type ImportStoreOptions, type MidenConfig, MidenError, type MidenErrorCode, MidenProvider, type MidenState, type MigrateStorageOptions, type MintOptions, type MultiSendOptions, type MultiSendRecipient, type MultiSignerContextValue, MultiSignerProvider, type MutationResult, type NoteAsset, type NoteAttachmentData, type NoteSummary, type NotesFilter, type NotesResult, type ProverConfig, type ProverTarget, type ProverUrls, type PswapCancelByOrderOptions, type PswapCancelOptions, type PswapConsumeOptions, type PswapCreateOptions, type PswapLineageResult, type PswapLineagesResult, type QueryResult, type RpcUrlConfig, type SendOptions, type SendResult, type SessionAccountStep, type SignCallback, type SignerAccountConfig, type SignerAccountType, SignerContext, type SignerContextValue, SignerSlot, type StreamedNote, type SwapOptions, type SyncState, type TransactionHistoryOptions, type TransactionHistoryResult, type TransactionResult, type TransactionStage, type TransactionStatus, type UseCompileResult, type UseConsumeResult, type UseCreateFaucetResult, type UseCreateWalletResult, type UseExecuteProgramResult, type UseExportNoteResult, type UseExportStoreResult, type UseImportAccountResult, type UseImportNoteResult, type UseImportStoreResult, type UseMintResult, type UseMultiSendResult, type UseNoteStreamOptions, type UseNoteStreamReturn, type UsePswapCancelByOrderResult, type UsePswapCancelResult, type UsePswapConsumeResult, type UsePswapCreateResult, type UsePswapLineageResult, type UsePswapLineagesForResult, type UsePswapLineagesResult, type UseSendResult, type UseSessionAccountOptions, type UseSessionAccountReturn, type UseSwapResult, type UseSyncControlResult, type UseSyncStateResult, type UseTransactionHistoryResult, type UseTransactionResult, type UseWaitForCommitResult, type UseWaitForNotesResult, type WaitForCommitOptions, type WaitForNotesOptions, type WalletAdapterLike, accountIdsEqual, bigIntToBytes, bytesToBigInt, clearMidenStorage, concatBytes, createMidenStorage, createNoteAttachment, ensureAccountBech32, formatAssetAmount, formatNoteSummary, getNoteSummary, installAccountBech32, migrateStorage, normalizeAccountId, parseAssetAmount, readNoteAttachment, toBech32AccountId, useAccount, useAccounts, useAssetMetadata, useCompile, useConsume, useCreateFaucet, useCreateWallet, useExecuteProgram, useExportNote, useExportStore, useImportAccount, useImportNote, useImportStore, useMiden, useMidenClient, useMint, useMultiSend, useMultiSigner, useNoteStream, useNotes, usePswapCancel, usePswapCancelByOrder, usePswapConsume, usePswapCreate, usePswapLineage, usePswapLineages, usePswapLineagesFor, useSend, useSessionAccount, useSigner, useSwap, useSyncControl, useSyncState, useTransaction, useTransactionHistory, useWaitForCommit, useWaitForNotes, waitForWalletDetection, wrapWasmError };
1914
+ export { type AccountRef, type AccountResult, type AccountsResult, type AssetBalance, type AssetMetadata, type BridgeOptions, type ConsumeOptions, type CreateFaucetOptions, type CreateWalletOptions, DEFAULTS, type ExecuteProgramOptions, type ExecuteProgramResult, type ExecuteTransactionOptions, type ImportAccountOptions, type ImportStoreOptions, type MidenConfig, MidenError, type MidenErrorCode, MidenProvider, type MidenState, type MigrateStorageOptions, type MintOptions, type MultiSendOptions, type MultiSendRecipient, type MultiSignerContextValue, MultiSignerProvider, type MutationResult, type NoteAsset, type NoteAttachmentData, type NoteSummary, type NotesFilter, type NotesResult, type ProverConfig, type ProverTarget, type ProverUrls, type PswapCancelByOrderOptions, type PswapCancelOptions, type PswapConsumeOptions, type PswapCreateOptions, type PswapLineageResult, type PswapLineagesResult, type QueryResult, type RpcUrlConfig, type SendOptions, type SendResult, type SessionAccountStep, type SignCallback, type SignerAccountConfig, type SignerAccountType, SignerContext, type SignerContextValue, SignerSlot, type StreamedNote, type SwapOptions, type SyncState, type TransactionHistoryOptions, type TransactionHistoryResult, type TransactionResult, type TransactionStage, type TransactionStatus, type UseBridgeResult, type UseCompileResult, type UseConsumeResult, type UseCreateFaucetResult, type UseCreateWalletResult, type UseExecuteProgramResult, type UseExportNoteResult, type UseExportStoreResult, type UseImportAccountResult, type UseImportNoteResult, type UseImportStoreResult, type UseMintResult, type UseMultiSendResult, type UseNoteStreamOptions, type UseNoteStreamReturn, type UsePswapCancelByOrderResult, type UsePswapCancelResult, type UsePswapConsumeResult, type UsePswapCreateResult, type UsePswapLineageResult, type UsePswapLineagesForResult, type UsePswapLineagesResult, type UseSendResult, type UseSessionAccountOptions, type UseSessionAccountReturn, type UseSwapResult, type UseSyncControlResult, type UseSyncStateResult, type UseTransactionHistoryResult, type UseTransactionResult, type UseWaitForCommitResult, type UseWaitForNotesResult, type WaitForCommitOptions, type WaitForNotesOptions, type WalletAdapterLike, accountIdsEqual, bigIntToBytes, bytesToBigInt, clearMidenStorage, concatBytes, createMidenStorage, createNoteAttachment, ensureAccountBech32, formatAssetAmount, formatNoteSummary, getNoteSummary, installAccountBech32, migrateStorage, normalizeAccountId, parseAssetAmount, readNoteAttachment, toBech32AccountId, useAccount, useAccounts, useAssetMetadata, useBridge, useCompile, useConsume, useCreateFaucet, useCreateWallet, useExecuteProgram, useExportNote, useExportStore, useImportAccount, useImportNote, useImportStore, useMiden, useMidenClient, useMint, useMultiSend, useMultiSigner, useNoteStream, useNotes, usePswapCancel, usePswapCancelByOrder, usePswapConsume, usePswapCreate, usePswapLineage, usePswapLineages, usePswapLineagesFor, useSend, useSessionAccount, useSigner, useSwap, useSyncControl, useSyncState, useTransaction, useTransactionHistory, useWaitForCommit, useWaitForNotes, waitForWalletDetection, wrapWasmError };
package/dist/index.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";
2767
- function useConsume() {
2766
+ import { EthAddress } from "@miden-sdk/miden-sdk";
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";
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");
@@ -3231,7 +3306,7 @@ function usePswapCancelByOrder() {
3231
3306
  }
3232
3307
 
3233
3308
  // src/hooks/useTransaction.ts
3234
- import { useCallback as useCallback26, useRef as useRef9, useState as useState22 } from "react";
3309
+ import { useCallback as useCallback27, useRef as useRef9, useState as useState23 } from "react";
3235
3310
 
3236
3311
  // src/utils/transactions.ts
3237
3312
  import { NoteType as NoteType4, TransactionFilter as TransactionFilter4 } from "@miden-sdk/miden-sdk";
@@ -3278,11 +3353,11 @@ function useTransaction() {
3278
3353
  const { client, isReady, sync, runExclusive } = useMiden();
3279
3354
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3280
3355
  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(
3356
+ const [result, setResult] = useState23(null);
3357
+ const [isLoading, setIsLoading] = useState23(false);
3358
+ const [stage, setStage] = useState23("idle");
3359
+ const [error, setError] = useState23(null);
3360
+ const execute = useCallback27(
3286
3361
  async (options) => {
3287
3362
  if (!client || !isReady) {
3288
3363
  throw new Error("Miden client is not ready");
@@ -3349,7 +3424,7 @@ function useTransaction() {
3349
3424
  },
3350
3425
  [client, isReady, runExclusive, sync]
3351
3426
  );
3352
- const reset = useCallback26(() => {
3427
+ const reset = useCallback27(() => {
3353
3428
  setResult(null);
3354
3429
  setIsLoading(false);
3355
3430
  setStage("idle");
@@ -3372,7 +3447,7 @@ async function resolveRequest(request, client) {
3372
3447
  }
3373
3448
 
3374
3449
  // src/hooks/useExecuteProgram.ts
3375
- import { useCallback as useCallback27, useRef as useRef10, useState as useState23 } from "react";
3450
+ import { useCallback as useCallback28, useRef as useRef10, useState as useState24 } from "react";
3376
3451
  import {
3377
3452
  AdviceInputs,
3378
3453
  ForeignAccount,
@@ -3386,10 +3461,10 @@ function useExecuteProgram() {
3386
3461
  const { client, isReady, sync, runExclusive } = useMiden();
3387
3462
  const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
3388
3463
  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(
3464
+ const [result, setResult] = useState24(null);
3465
+ const [isLoading, setIsLoading] = useState24(false);
3466
+ const [error, setError] = useState24(null);
3467
+ const execute = useCallback28(
3393
3468
  async (options) => {
3394
3469
  if (!client || !isReady) {
3395
3470
  throw new Error("Miden client is not ready");
@@ -3448,7 +3523,7 @@ function useExecuteProgram() {
3448
3523
  },
3449
3524
  [client, isReady, runExclusive, sync]
3450
3525
  );
3451
- const reset = useCallback27(() => {
3526
+ const reset = useCallback28(() => {
3452
3527
  setResult(null);
3453
3528
  setIsLoading(false);
3454
3529
  setError(null);
@@ -3463,7 +3538,7 @@ function useExecuteProgram() {
3463
3538
  }
3464
3539
 
3465
3540
  // src/hooks/useCompile.ts
3466
- import { useCallback as useCallback28, useMemo as useMemo9 } from "react";
3541
+ import { useCallback as useCallback29, useMemo as useMemo9 } from "react";
3467
3542
  import { CompilerResource, getWasmOrThrow } from "@miden-sdk/miden-sdk";
3468
3543
  function useCompile() {
3469
3544
  const { client, isReady } = useMiden();
@@ -3471,21 +3546,21 @@ function useCompile() {
3471
3546
  () => client && isReady ? new CompilerResource(client, getWasmOrThrow) : null,
3472
3547
  [client, isReady]
3473
3548
  );
3474
- const requireResource = useCallback28(() => {
3549
+ const requireResource = useCallback29(() => {
3475
3550
  if (!resource) {
3476
3551
  throw new Error("Miden client is not ready");
3477
3552
  }
3478
3553
  return resource;
3479
3554
  }, [resource]);
3480
- const component = useCallback28(
3555
+ const component = useCallback29(
3481
3556
  async (options) => requireResource().component(options),
3482
3557
  [requireResource]
3483
3558
  );
3484
- const txScript = useCallback28(
3559
+ const txScript = useCallback29(
3485
3560
  async (options) => requireResource().txScript(options),
3486
3561
  [requireResource]
3487
3562
  );
3488
- const noteScript = useCallback28(
3563
+ const noteScript = useCallback29(
3489
3564
  async (options) => requireResource().noteScript(options),
3490
3565
  [requireResource]
3491
3566
  );
@@ -3493,14 +3568,14 @@ function useCompile() {
3493
3568
  }
3494
3569
 
3495
3570
  // src/hooks/useSessionAccount.ts
3496
- import { useCallback as useCallback29, useEffect as useEffect12, useRef as useRef11, useState as useState24 } from "react";
3571
+ import { useCallback as useCallback30, useEffect as useEffect12, useRef as useRef11, useState as useState25 } from "react";
3497
3572
  import { AccountStorageMode as AccountStorageMode3 } from "@miden-sdk/miden-sdk";
3498
3573
  function useSessionAccount(options) {
3499
3574
  const { client, isReady, sync } = useMiden();
3500
3575
  const setAccounts = useMidenStore((state) => state.setAccounts);
3501
- const [sessionAccountId, setSessionAccountId] = useState24(null);
3502
- const [step, setStep] = useState24("idle");
3503
- const [error, setError] = useState24(null);
3576
+ const [sessionAccountId, setSessionAccountId] = useState25(null);
3577
+ const [step, setStep] = useState25("idle");
3578
+ const [error, setError] = useState25(null);
3504
3579
  const cancelledRef = useRef11(false);
3505
3580
  const isBusyRef = useRef11(false);
3506
3581
  const storagePrefix = options.storagePrefix ?? "miden-session";
@@ -3527,7 +3602,7 @@ function useSessionAccount(options) {
3527
3602
  localStorage.removeItem(`${storagePrefix}:ready`);
3528
3603
  }
3529
3604
  }, [storagePrefix]);
3530
- const initialize = useCallback29(async () => {
3605
+ const initialize = useCallback30(async () => {
3531
3606
  if (!client || !isReady) {
3532
3607
  throw new Error("Miden client is not ready");
3533
3608
  }
@@ -3591,7 +3666,7 @@ function useSessionAccount(options) {
3591
3666
  maxWaitMs,
3592
3667
  setAccounts
3593
3668
  ]);
3594
- const reset = useCallback29(() => {
3669
+ const reset = useCallback30(() => {
3595
3670
  cancelledRef.current = true;
3596
3671
  isBusyRef.current = false;
3597
3672
  setSessionAccountId(null);
@@ -3640,13 +3715,13 @@ async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cance
3640
3715
  }
3641
3716
 
3642
3717
  // src/hooks/useExportStore.ts
3643
- import { useCallback as useCallback30, useState as useState25 } from "react";
3718
+ import { useCallback as useCallback31, useState as useState26 } from "react";
3644
3719
  import { exportStore as sdkExportStore } from "@miden-sdk/miden-sdk";
3645
3720
  function useExportStore() {
3646
3721
  const { client, isReady, runExclusive } = useMiden();
3647
- const [isExporting, setIsExporting] = useState25(false);
3648
- const [error, setError] = useState25(null);
3649
- const exportStore = useCallback30(async () => {
3722
+ const [isExporting, setIsExporting] = useState26(false);
3723
+ const [error, setError] = useState26(null);
3724
+ const exportStore = useCallback31(async () => {
3650
3725
  if (!client || !isReady) {
3651
3726
  throw new Error("Miden client is not ready");
3652
3727
  }
@@ -3664,7 +3739,7 @@ function useExportStore() {
3664
3739
  setIsExporting(false);
3665
3740
  }
3666
3741
  }, [client, isReady, runExclusive]);
3667
- const reset = useCallback30(() => {
3742
+ const reset = useCallback31(() => {
3668
3743
  setIsExporting(false);
3669
3744
  setError(null);
3670
3745
  }, []);
@@ -3677,13 +3752,13 @@ function useExportStore() {
3677
3752
  }
3678
3753
 
3679
3754
  // src/hooks/useImportStore.ts
3680
- import { useCallback as useCallback31, useState as useState26 } from "react";
3755
+ import { useCallback as useCallback32, useState as useState27 } from "react";
3681
3756
  import { importStore as sdkImportStore } from "@miden-sdk/miden-sdk";
3682
3757
  function useImportStore() {
3683
3758
  const { client, isReady, runExclusive, sync } = useMiden();
3684
- const [isImporting, setIsImporting] = useState26(false);
3685
- const [error, setError] = useState26(null);
3686
- const importStore = useCallback31(
3759
+ const [isImporting, setIsImporting] = useState27(false);
3760
+ const [error, setError] = useState27(null);
3761
+ const importStore = useCallback32(
3687
3762
  async (storeDump, storeName, options) => {
3688
3763
  if (!client || !isReady) {
3689
3764
  throw new Error("Miden client is not ready");
@@ -3705,7 +3780,7 @@ function useImportStore() {
3705
3780
  },
3706
3781
  [client, isReady, runExclusive, sync]
3707
3782
  );
3708
- const reset = useCallback31(() => {
3783
+ const reset = useCallback32(() => {
3709
3784
  setIsImporting(false);
3710
3785
  setError(null);
3711
3786
  }, []);
@@ -3718,13 +3793,13 @@ function useImportStore() {
3718
3793
  }
3719
3794
 
3720
3795
  // src/hooks/useImportNote.ts
3721
- import { useCallback as useCallback32, useState as useState27 } from "react";
3796
+ import { useCallback as useCallback33, useState as useState28 } from "react";
3722
3797
  import { NoteFile } from "@miden-sdk/miden-sdk";
3723
3798
  function useImportNote() {
3724
3799
  const { client, isReady, runExclusive, sync } = useMiden();
3725
- const [isImporting, setIsImporting] = useState27(false);
3726
- const [error, setError] = useState27(null);
3727
- const importNote = useCallback32(
3800
+ const [isImporting, setIsImporting] = useState28(false);
3801
+ const [error, setError] = useState28(null);
3802
+ const importNote = useCallback33(
3728
3803
  async (noteBytes) => {
3729
3804
  if (!client || !isReady) {
3730
3805
  throw new Error("Miden client is not ready");
@@ -3748,7 +3823,7 @@ function useImportNote() {
3748
3823
  },
3749
3824
  [client, isReady, runExclusive, sync]
3750
3825
  );
3751
- const reset = useCallback32(() => {
3826
+ const reset = useCallback33(() => {
3752
3827
  setIsImporting(false);
3753
3828
  setError(null);
3754
3829
  }, []);
@@ -3761,13 +3836,13 @@ function useImportNote() {
3761
3836
  }
3762
3837
 
3763
3838
  // src/hooks/useExportNote.ts
3764
- import { useCallback as useCallback33, useState as useState28 } from "react";
3839
+ import { useCallback as useCallback34, useState as useState29 } from "react";
3765
3840
  import { NoteExportFormat } from "@miden-sdk/miden-sdk";
3766
3841
  function useExportNote() {
3767
3842
  const { client, isReady, runExclusive } = useMiden();
3768
- const [isExporting, setIsExporting] = useState28(false);
3769
- const [error, setError] = useState28(null);
3770
- const exportNote = useCallback33(
3843
+ const [isExporting, setIsExporting] = useState29(false);
3844
+ const [error, setError] = useState29(null);
3845
+ const exportNote = useCallback34(
3771
3846
  async (noteId) => {
3772
3847
  if (!client || !isReady) {
3773
3848
  throw new Error("Miden client is not ready");
@@ -3789,7 +3864,7 @@ function useExportNote() {
3789
3864
  },
3790
3865
  [client, isReady, runExclusive]
3791
3866
  );
3792
- const reset = useCallback33(() => {
3867
+ const reset = useCallback34(() => {
3793
3868
  setIsExporting(false);
3794
3869
  setError(null);
3795
3870
  }, []);
@@ -3802,12 +3877,12 @@ function useExportNote() {
3802
3877
  }
3803
3878
 
3804
3879
  // src/hooks/useSyncControl.ts
3805
- import { useCallback as useCallback34 } from "react";
3880
+ import { useCallback as useCallback35 } from "react";
3806
3881
  function useSyncControl() {
3807
3882
  const isPaused = useMidenStore((state) => state.syncPaused);
3808
3883
  const setSyncPaused = useMidenStore((state) => state.setSyncPaused);
3809
- const pauseSync = useCallback34(() => setSyncPaused(true), [setSyncPaused]);
3810
- const resumeSync = useCallback34(() => setSyncPaused(false), [setSyncPaused]);
3884
+ const pauseSync = useCallback35(() => setSyncPaused(true), [setSyncPaused]);
3885
+ const resumeSync = useCallback35(() => setSyncPaused(false), [setSyncPaused]);
3811
3886
  return {
3812
3887
  pauseSync,
3813
3888
  resumeSync,
@@ -3992,6 +4067,7 @@ export {
3992
4067
  useAccount,
3993
4068
  useAccounts,
3994
4069
  useAssetMetadata,
4070
+ useBridge,
3995
4071
  useCompile,
3996
4072
  useConsume,
3997
4073
  useCreateFaucet,