@miden-sdk/create-para-react 0.16.0 → 0.16.2

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/AGENTS.md ADDED
@@ -0,0 +1,86 @@
1
+ # @miden-sdk/create-para-react - Agent Guide
2
+
3
+ **Audience: AI coding agents** starting a Miden app that authenticates with
4
+ Para, or working inside one this CLI produced.
5
+
6
+ This file ships inside the published package, so the copy at
7
+ `node_modules/@miden-sdk/create-para-react/AGENTS.md` matches the version you
8
+ ran. Prefer it over your training data: the template it writes was rebuilt
9
+ around `ParaSignerProvider` and Para SDK 3.18, and no longer looks like the one
10
+ you may remember.
11
+
12
+ ## Running it
13
+
14
+ ```bash
15
+ npm create @miden-sdk/para-react@latest my-app
16
+ ```
17
+
18
+ The first non-flag argument is the target directory (default
19
+ `miden-para-react-app`). `--skip-install` or `--no-install` stops before
20
+ dependency installation; otherwise the package manager is detected from
21
+ `npm_config_user_agent` (`pnpm`, `yarn`, `bun`, else `npm`). `--skip-scaffold`
22
+ or `--no-scaffold` writes a minimal project itself instead of shelling out to
23
+ `create-vite`, which is what the CLI's own tests use and what avoids that one
24
+ network round trip. Set
25
+ `VITE_PARA_API_KEY` before `npm run dev` - the starter reads it through
26
+ `import.meta.env`, and a production deployment needs a Para production key.
27
+
28
+ ## What you get, so you do not rebuild it
29
+
30
+ The CLI scaffolds the upstream Vite `react-ts` template
31
+ (`npm create vite@latest <name> -- --template react-ts --yes --no-install`) and
32
+ then patches it. Everything below is already done in a fresh project:
33
+
34
+ - **`src/App.tsx`** - a `ParaSignerProvider` wrapping `MidenProvider`
35
+ (`rpcUrl: "testnet"`), with a connect button driven by `useSigner()` and
36
+ status read from `useParaSigner()` and `useMiden()`. This is the current
37
+ integration path; the older `useParaMiden` hook is not used here.
38
+ - **`vite.config.ts`** - React, `vite-plugin-wasm`, `vite-plugin-top-level-await`
39
+ and `vite-plugin-node-polyfills` (`buffer`, `crypto`, `stream`, `util`), plus a
40
+ local `externalizeOptionalPackages` plugin that externalizes Para's optional
41
+ `@getpara/aa-*`, Solana and Cosmos connectors and the wagmi packages. Also
42
+ `esnext` targets, `worker.format: "es"`, `.wasm` as a static asset, and dedupe
43
+ for the Para and React copies. The template inlines this rather than calling
44
+ `paraVitePlugin()`; an app that adopts `@miden-sdk/vite-plugin` later can
45
+ switch to the plugin pair instead.
46
+ - **`src/polyfills.ts`**, imported from `src/main.tsx`, providing `Buffer` and
47
+ `process` in the browser. `src/optional-connectors.ts` is copied in beside it
48
+ as an empty module: the template config externalizes the optional connectors
49
+ rather than aliasing them, so nothing imports this stub today, and it is there
50
+ to alias them to if you change that.
51
+ - **`package.json`** - Para and Miden dependencies at matched versions, a
52
+ `resolutions` block pinning the `@getpara/*` packages to exactly `3.18.0`, and
53
+ a `postinstall: setup-para` script.
54
+ - **`tsconfig.node.json`** - switched to `module: "esnext"` +
55
+ `moduleResolution: "bundler"`. Under `nodenext`, `vite-plugin-wasm` and
56
+ `vite-plugin-top-level-await` are read as CommonJS because they ship ESM
57
+ declarations without `"type": "module"`, and the config fails to compile with
58
+ `TS2349: This expression is not callable`.
59
+ - **`.npmrc`** with `legacy-peer-deps=true`, so `npm install` resolves the Para
60
+ and Miden peer graph.
61
+
62
+ ## Pins that are load-bearing
63
+
64
+ `@swc/core` is held at `~1.15.47`. `vite-plugin-top-level-await` drives swc's
65
+ AST printer, and 1.16 changed that AST's schema, so a caret range resolves to a
66
+ version the plugin cannot use and the build dies in `generateBundle` with
67
+ ``missing field `type` ``. `rollup` and `esbuild` are added for a related
68
+ reason: that same plugin `require`s both without declaring them, and Vite 8 no
69
+ longer installs either transitively. Do not drop or widen these while chasing an
70
+ unrelated dependency warning.
71
+
72
+ ## Working on the generated app
73
+
74
+ The integration itself is documented by the packages the template installs:
75
+ `node_modules/@miden-sdk/para-react/AGENTS.md` for the provider and hooks,
76
+ `node_modules/@miden-sdk/para/skills/para-signer/SKILL.md` for the full guide,
77
+ and `node_modules/@miden-sdk/react/AGENTS.md` for the Miden hooks the starter
78
+ calls.
79
+
80
+ ## Going deeper
81
+
82
+ - Para's own SDK documentation: <https://docs.getpara.com>.
83
+ - Miden narrative docs:
84
+ <https://docs.miden.xyz/builder/tools/clients/react-sdk/>.
85
+ - Breaking changes at upgrade time: the `CHANGELOG.md` in
86
+ [`0xMiden/web-sdk`](https://github.com/0xMiden/web-sdk).
@@ -34,12 +34,13 @@ const templateOptionalConnectorsPath = resolve(
34
34
  "src",
35
35
  "optional-connectors.ts"
36
36
  );
37
- const repoRoot = resolve(__dirname, "..", "..", "..");
37
+ const repoRoot = resolve(__dirname, "..", "..", "..", "..");
38
38
  const localMidenParaPath =
39
- process.env.MIDEN_PARA_LOCAL_MIDEN_PARA_PATH ?? repoRoot;
39
+ process.env.MIDEN_PARA_LOCAL_MIDEN_PARA_PATH ??
40
+ join(repoRoot, "packages", "para", "core");
40
41
  const localUseMidenParaReactPath =
41
42
  process.env.MIDEN_PARA_LOCAL_USE_MIDEN_PARA_REACT_PATH ??
42
- join(repoRoot, "packages", "use-miden-para-react");
43
+ join(repoRoot, "packages", "para", "react");
43
44
  const useLocalDeps = process.env.MIDEN_PARA_LOCAL_DEPS === "1";
44
45
 
45
46
  const args = process.argv.slice(2);
@@ -283,20 +284,23 @@ function ensureMidenParaDependencies(targetRoot) {
283
284
  pkg.scripts = pkg.scripts ?? {};
284
285
  const midenParaVersion = useLocalDeps
285
286
  ? `file:${localMidenParaPath}`
286
- : "0.15.1";
287
+ : "0.16.1";
287
288
  const useMidenParaReactVersion = useLocalDeps
288
289
  ? `file:${localUseMidenParaReactPath}`
289
- : "^0.15.1";
290
+ : "^0.16.1";
290
291
  // Align with examples/react-signer so Para SDK connector peers are satisfied
291
292
  Object.assign(pkg.dependencies, {
292
293
  ...pkg.dependencies,
293
- "@getpara/react-sdk-lite": "^2.2.0",
294
- "@getpara/evm-wallet-connectors": "^2.2.0",
295
- "@miden-sdk/miden-sdk": "^0.15.1",
294
+ "@getpara/react-sdk-lite": "^3.18.0",
295
+ "@getpara/evm-wallet-connectors": "^3.18.0",
296
+ "@miden-sdk/miden-sdk": "^0.16.1",
296
297
  "@miden-sdk/para": midenParaVersion,
297
298
  "@miden-sdk/para-react": useMidenParaReactVersion,
298
- "@miden-sdk/react": "^0.15.1",
299
+ "@miden-sdk/react": "^0.16.0",
299
300
  "@tanstack/react-query": "^5.0.0",
301
+ viem: "^2.39.0",
302
+ wagmi: "^2.14.16",
303
+ "@wagmi/core": "^2.16.7",
300
304
  });
301
305
 
302
306
  Object.assign(pkg.devDependencies, {
@@ -311,8 +315,10 @@ function ensureMidenParaDependencies(targetRoot) {
311
315
  });
312
316
 
313
317
  Object.assign(pkg.resolutions, {
314
- "@getpara/react-sdk": "2.0.0-alpha.73",
315
- "@getpara/web-sdk": "2.0.0-alpha.73",
318
+ "@getpara/react-sdk": "3.18.0",
319
+ "@getpara/web-sdk": "3.18.0",
320
+ "@getpara/react-sdk-lite": "3.18.0",
321
+ "@getpara/evm-wallet-connectors": "3.18.0",
316
322
  });
317
323
 
318
324
  Object.assign(pkg.scripts, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miden-sdk/create-para-react",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "Create a Vite react-ts app preconfigured with Miden + Para's Vite setup",
5
5
  "type": "module",
6
6
  "bin": "./bin/create-miden-para-react.mjs",
@@ -8,6 +8,7 @@
8
8
  "bin",
9
9
  "template",
10
10
  "README.md",
11
+ "AGENTS.md",
11
12
  "package.json"
12
13
  ],
13
14
  "engines": {