@miden-sdk/react 0.14.4 → 0.15.0-alpha.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/dist/index.mjs CHANGED
@@ -402,10 +402,7 @@ function resolveProverTarget(target, config) {
402
402
  return TransactionProver.newLocalProver();
403
403
  }
404
404
  if (normalized === "devnet" || normalized === "testnet") {
405
- const url = config.proverUrls?.[normalized] ?? DEFAULT_PROVER_URLS[normalized] ?? null;
406
- if (!url) {
407
- throw new Error(`Missing ${normalized} prover URL`);
408
- }
405
+ const url = config.proverUrls?.[normalized] ?? DEFAULT_PROVER_URLS[normalized];
409
406
  return TransactionProver.newRemoteProver(
410
407
  url,
411
408
  normalizeTimeout(config.proverTimeoutMs)
@@ -553,20 +550,15 @@ function MidenProvider({
553
550
  }),
554
551
  [config]
555
552
  );
556
- const [defaultProver, setDefaultProver] = useState(null);
557
- useEffect(() => {
558
- if (!isReady) {
559
- setDefaultProver(null);
560
- return;
561
- }
562
- setDefaultProver(resolveTransactionProver(resolvedConfig));
563
- }, [
564
- isReady,
565
- resolvedConfig.prover,
566
- resolvedConfig.proverTimeoutMs,
567
- resolvedConfig.proverUrls?.devnet,
568
- resolvedConfig.proverUrls?.testnet
569
- ]);
553
+ const defaultProver = useMemo(
554
+ () => resolveTransactionProver(resolvedConfig),
555
+ [
556
+ resolvedConfig.prover,
557
+ resolvedConfig.proverTimeoutMs,
558
+ resolvedConfig.proverUrls?.devnet,
559
+ resolvedConfig.proverUrls?.testnet
560
+ ]
561
+ );
570
562
  const runExclusive = useCallback(
571
563
  async (fn) => clientLockRef.current.runExclusive(fn),
572
564
  []
@@ -2279,7 +2271,7 @@ function useSend() {
2279
2271
  );
2280
2272
  txRequest = new TransactionRequestBuilder().withOwnOutputNotes(new NoteArray([note])).build();
2281
2273
  } else {
2282
- txRequest = client.newSendTransactionRequest(
2274
+ txRequest = await client.newSendTransactionRequest(
2283
2275
  fromAccountId,
2284
2276
  toAccountId,
2285
2277
  assetIdObj,
@@ -2296,7 +2288,7 @@ function useSend() {
2296
2288
  const proverConfig = useMidenStore.getState().config;
2297
2289
  const provenTransaction = await proveWithFallback(
2298
2290
  (resolvedProver) => runExclusiveSafe(
2299
- () => resolvedProver ? client.proveTransactionWithProver(txResult, resolvedProver) : client.proveTransaction(txResult)
2291
+ () => client.proveTransaction(txResult, resolvedProver)
2300
2292
  ),
2301
2293
  proverConfig
2302
2294
  );
@@ -2448,7 +2440,7 @@ function useMultiSend() {
2448
2440
  const proverConfig = useMidenStore.getState().config;
2449
2441
  const provenTransaction = await proveWithFallback(
2450
2442
  (resolvedProver) => runExclusiveDirect(
2451
- () => resolvedProver ? client.proveTransactionWithProver(txResult, resolvedProver) : client.proveTransaction(txResult)
2443
+ () => client.proveTransaction(txResult, resolvedProver)
2452
2444
  ),
2453
2445
  proverConfig
2454
2446
  );
@@ -2614,7 +2606,7 @@ function useMint() {
2614
2606
  const faucetIdObj = parseAccountId(options.faucetId);
2615
2607
  setStage("proving");
2616
2608
  const txResult = await runExclusiveSafe(async () => {
2617
- const txRequest = client.newMintTransactionRequest(
2609
+ const txRequest = await client.newMintTransactionRequest(
2618
2610
  targetAccountIdObj,
2619
2611
  faucetIdObj,
2620
2612
  noteType,
@@ -2720,12 +2712,6 @@ function useConsume() {
2720
2712
  }
2721
2713
  }
2722
2714
  const notes = resolved;
2723
- if (notes.length === 0) {
2724
- throw new Error("No notes found for provided IDs");
2725
- }
2726
- if (notes.length !== options.notes.length) {
2727
- throw new Error("Some notes could not be found for provided IDs");
2728
- }
2729
2715
  const txRequest = client.newConsumeTransactionRequest(notes);
2730
2716
  const txId = prover ? await client.submitNewTransactionWithProver(
2731
2717
  accountIdObj,
@@ -2792,7 +2778,7 @@ function useSwap() {
2792
2778
  const requestedFaucetIdObj = parseAccountId(options.requestedFaucetId);
2793
2779
  setStage("proving");
2794
2780
  const txResult = await runExclusiveSafe(async () => {
2795
- const txRequest = client.newSwapTransactionRequest(
2781
+ const txRequest = await client.newSwapTransactionRequest(
2796
2782
  accountIdObj,
2797
2783
  offeredFaucetIdObj,
2798
2784
  BigInt(options.offeredAmount),
@@ -2919,7 +2905,7 @@ function useTransaction() {
2919
2905
  const proverConfig = useMidenStore.getState().config;
2920
2906
  const provenTransaction = await proveWithFallback(
2921
2907
  (resolvedProver) => runExclusiveSafe(
2922
- () => resolvedProver ? client.proveTransactionWithProver(txResult, resolvedProver) : client.proveTransaction(txResult)
2908
+ () => client.proveTransaction(txResult, resolvedProver)
2923
2909
  ),
2924
2910
  proverConfig
2925
2911
  );
@@ -3268,7 +3254,7 @@ function useExportStore() {
3268
3254
  setIsExporting(true);
3269
3255
  setError(null);
3270
3256
  try {
3271
- const storeName = client.storeIdentifier();
3257
+ const storeName = await client.storeIdentifier();
3272
3258
  const snapshot = await runExclusive(() => sdkExportStore(storeName));
3273
3259
  return snapshot;
3274
3260
  } catch (err) {
@@ -3594,9 +3580,11 @@ export {
3594
3580
  concatBytes,
3595
3581
  createMidenStorage,
3596
3582
  createNoteAttachment,
3583
+ ensureAccountBech32,
3597
3584
  formatAssetAmount,
3598
3585
  formatNoteSummary,
3599
3586
  getNoteSummary,
3587
+ installAccountBech32,
3600
3588
  migrateStorage,
3601
3589
  normalizeAccountId,
3602
3590
  parseAssetAmount,
package/package.json CHANGED
@@ -1,59 +1,50 @@
1
1
  {
2
2
  "name": "@miden-sdk/react",
3
- "version": "0.14.4",
3
+ "version": "0.15.0-alpha.4",
4
4
  "description": "React hooks library for Miden Web Client",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
13
18
  },
14
- "./lazy": {
15
- "types": "./dist/lazy.d.ts",
16
- "import": "./dist/lazy.mjs",
17
- "require": "./dist/lazy.js"
18
- }
19
+ "./package.json": "./package.json"
19
20
  },
20
21
  "files": [
21
22
  "dist",
22
23
  "README.md",
23
24
  "CLAUDE.md"
24
25
  ],
25
- "scripts": {
26
- "build": "tsup",
27
- "dev": "tsup --watch",
28
- "lint": "eslint src",
29
- "typecheck": "tsc --noEmit",
30
- "test": "VITE_CJS_IGNORE_WARNING=1 vitest run",
31
- "test:unit": "VITE_CJS_IGNORE_WARNING=1 vitest run",
32
- "test:integration": "yarn build && playwright test",
33
- "test:all": "VITE_CJS_IGNORE_WARNING=1 vitest run && playwright test"
34
- },
35
26
  "peerDependencies": {
36
- "@miden-sdk/miden-sdk": "^0.14.4",
27
+ "@miden-sdk/miden-sdk": "^0.15.0-alpha.4",
37
28
  "react": ">=18.0.0"
38
29
  },
39
30
  "dependencies": {
40
31
  "zustand": "^5.0.0"
41
32
  },
42
33
  "devDependencies": {
43
- "@miden-sdk/miden-sdk": "file:../../crates/web-client",
44
34
  "@playwright/test": "^1.55.0",
45
35
  "@testing-library/react": "^14.0.0",
46
36
  "@types/react": "^18.2.0",
47
- "@typescript-eslint/eslint-plugin": "^6.0.0",
48
- "@typescript-eslint/parser": "^6.0.0",
49
- "eslint": "^8.0.0",
50
- "http-server": "^14.1.1",
37
+ "@typescript-eslint/eslint-plugin": "^8.25.0",
38
+ "@typescript-eslint/parser": "^8.25.0",
39
+ "@vitest/coverage-v8": "^3.0.0",
40
+ "eslint": "^9.30.1",
51
41
  "jsdom": "^24.0.0",
52
42
  "react": "^18.2.0",
53
43
  "react-dom": "^18.2.0",
54
44
  "tsup": "^8.0.0",
55
45
  "typescript": "^5.0.0",
56
- "vitest": "^1.0.0"
46
+ "vitest": "^3.0.0",
47
+ "@miden-sdk/miden-sdk": "0.15.0-alpha.4"
57
48
  },
58
49
  "keywords": [
59
50
  "miden",
@@ -67,16 +58,20 @@
67
58
  "license": "MIT",
68
59
  "repository": {
69
60
  "type": "git",
70
- "url": "https://github.com/0xMiden/miden-client"
61
+ "url": "https://github.com/0xMiden/web-sdk"
71
62
  },
72
63
  "bugs": {
73
- "url": "https://github.com/0xMiden/miden-client/issues"
64
+ "url": "https://github.com/0xMiden/web-sdk/issues"
74
65
  },
75
- "resolutions": {
76
- "@isaacs/brace-expansion": ">=5.0.1",
77
- "esbuild": ">=0.25.0",
78
- "minimatch": ">=10.2.1",
79
- "rollup": ">=4.59.0",
80
- "qs": ">=6.15.0"
66
+ "scripts": {
67
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
68
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
69
+ "lint": "eslint src",
70
+ "typecheck": "tsc --noEmit",
71
+ "test": "VITE_CJS_IGNORE_WARNING=1 vitest run",
72
+ "test:unit": "VITE_CJS_IGNORE_WARNING=1 vitest run",
73
+ "test:coverage": "VITE_CJS_IGNORE_WARNING=1 vitest run --coverage",
74
+ "test:integration": "pnpm build && playwright test",
75
+ "test:all": "VITE_CJS_IGNORE_WARNING=1 vitest run && playwright test"
81
76
  }
82
- }
77
+ }