Skip to content

docs: migrate Quick Start TypeScript to MidenClient + fix migration ch07#241

Open
BrianSeong99 wants to merge 6 commits intomainfrom
brian/v14-docs-quickstart
Open

docs: migrate Quick Start TypeScript to MidenClient + fix migration ch07#241
BrianSeong99 wants to merge 6 commits intomainfrom
brian/v14-docs-quickstart

Conversation

@BrianSeong99
Copy link
Copy Markdown
Contributor

@BrianSeong99 BrianSeong99 commented Apr 13, 2026

Summary

Migrates the Quick Start TypeScript snippets from the v0.13 WebClient API to the v0.14 MidenClient resource-based API documented in migration guide ch07. Rust snippets were already v0.14 and are untouched.

Also fixes migration/07-client-changes.md so its code examples match what's actually shipped in @miden-sdk/miden-sdk@0.14.0 (and align with the original authored content in issue #239).

Changes

Quick Start (TypeScript)

  • setup/installation.md — new "Set Up TypeScript Project" section using a minimal Vite vanilla-ts scaffold. Each snippet goes in src/demo.ts and is called from src/main.ts.
  • accounts.md — 2 snippets (wallet creation, faucet creation) converted to MidenClient demo() functions using client.accounts.create({ type: "MutableWallet" | "FungibleFaucet", ... }).
  • notes.md — 3 snippets (mint, consume, send) using client.transactions.mint/consume/send with the shipped option shapes (account/to/token/type) and client.accounts.getBalance for balance reads.
  • read-storage.md — 2 snippets (counter read, balance read) using client.accounts.getOrImport + getBalance.

Migration guide ch07 fixes

Brought the published 07-client-changes.md back in line with shipped @miden-sdk/miden-sdk@0.14.0 (and Wiktor's original draft in #239):

  • @miden/sdk@miden-sdk/miden-sdk (correct package name).
  • MidenClient.createTestnet() now properly awaited.
  • Account creation field: storageModestorage.
  • Sending: { from, faucetId, noteType }{ account, token, type }, add waitForConfirmation.
  • Consuming: full After example (listAvailable + consume + consumeAll), not just the v0.13 Before.
  • Custom contracts: sourceCodesource, accountId: undefinedstorageSlots: [], add seed + auth, wrap scripts with client.compile.txScript, pass the Account (not .id) to transactions.execute.
  • Keystore: get(pubKeyCommitment) and getCommitments(accountId) — previous doc had wrong argument types for both.

Test plan

  • npm run build succeeds with zero new broken links on any changed page.
  • Every v0.13 identifier removed from docs/builder/get-started/ (WebClient, newWallet, newFaucet, createClient, submitNewTransaction, newMintTransactionRequest, newConsumeTransactionRequest, newSendTransactionRequest, export async function demo hook-era).
  • No React/hook API references leak into Quick Start (useMidenClient, useCreateWallet, useSend, MidenProvider, AppContent.tsx, @miden-sdk/react).
  • All MidenClient method signatures verified against @miden-sdk/miden-sdk@0.14.0 dist/api-types.d.ts.
  • Reviewer runs npm run start locally to preview.

BrianSeong99 and others added 4 commits April 13, 2026 14:04
- setup/installation.md: add "Set Up React App" section with one-time
  MidenProvider wiring (rpcUrl: "testnet" shortcut).
- accounts.md: convert wallet + faucet creation snippets to
  useCreateWallet / useCreateFaucet hooks.
- notes.md: convert mint / consume / send snippets to useMint /
  useWaitForNotes / useConsume / useSend (plus useMidenClient for
  post-consume balance read).
- read-storage.md: convert count + balance readers to useMidenClient.

Each snippet is a small React component mounted inside <MidenProvider>;
replaces the v0.13 demo() async-function style against the now-stale
WebClient API. Rust snippets untouched (already on v0.14).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ider

create-miden-app scaffolds src/providers.tsx with MidenProvider
already wired, and src/App.tsx renders AppProviders → AppContent.
RPC URL is config-driven via src/config.ts + VITE_MIDEN_RPC_URL.

- setup/installation.md: rewrite "Set Up React App" to reflect what
  the template actually does — no manual provider wiring, mount
  components in src/components/AppContent.tsx, env var for custom RPC.
- accounts.md, notes.md, read-storage.md: every snippet callout
  updated from "Mount inside <MidenProvider> in App.tsx" to
  "Import and render inside src/components/AppContent.tsx".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previous commit trimmed TypeScript Environment to a 2-line pointer.
Restore full per-guide scaffolding steps (yarn create-miden-app / cd /
yarn install, then touch src/components/X.tsx, then yarn dev), matching
the weight of the Rust Environment subsection above it. Keeps a link to
installation.md#set-up-react-app for the first-time setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…h07 field names

Switch Quick Start TypeScript snippets from the @miden-sdk/react hooks
direction to imperative MidenClient demo() functions — aligns with the
v0.14 migration guide chapter 07 and mirrors the Rust main() shape.
Setup becomes a plain Vite vanilla-ts scaffold; no React/MidenProvider.

- setup/installation.md: replace "Set Up React App" with "Set Up
  TypeScript Project" — vanilla-ts Vite, import demo() from main.ts.
- accounts.md: 2 snippets (wallet, faucet) as demo() using
  client.accounts.create({ type: "MutableWallet" | "FungibleFaucet" }).
- notes.md: 3 snippets (mint, consume, send) as demo() using
  client.transactions.mint/consume/send with correct option shapes
  (account/to/token/type, waitForConfirmation) and client.accounts.getBalance.
- read-storage.md: 2 snippets (count, balance) as demo() using
  client.accounts.getOrImport + getBalance, no useMidenClient hook.

Also fixes migration/07-client-changes.md to match what's actually
shipped in @miden-sdk/miden-sdk@0.14.0 (and Wiktor's original draft
in issue #239):
- @miden/sdk → @miden-sdk/miden-sdk (correct package name).
- createTestnet() now awaited.
- Account creation: storageMode → storage.
- Sending: from/faucetId/noteType → account/token/type (+ waitForConfirmation).
- Consuming: add the full After example (listAvailable + consume +
  consumeAll), not just the Before.
- Custom contracts: sourceCode → source, drop accountId, add
  storageSlots + seed + auth; use client.compile.txScript for scripts
  and pass the Account (not .id) to transactions.execute.
- Keystore: get(pubKeyCommitment), getCommitments(accountId) per
  shipped api-types; previous doc had the arguments wrong.

All v0.13 API names (WebClient, newWallet, newFaucet, newMint/Consume/
SendTransactionRequest, submitNewTransaction, storageMode, useX hooks,
MidenProvider, AppContent.tsx) removed from Quick Start. npm run build
passes with zero new broken links on any changed page.
@BrianSeong99 BrianSeong99 changed the title docs: migrate Quick Start TypeScript examples to @miden-sdk/react hooks docs: migrate Quick Start TypeScript to MidenClient + fix migration ch07 Apr 13, 2026
…p are symmetric

Move the `miden new my-test-project` step out of "Verify Installation"
(where it was buried as an h3 afterthought) and introduce a new
"Set Up a Project" h2 with two parallel h3 subsections — Rust Project
and TypeScript Project. "Verify Installation" is now focused on just
the midenup toolchain check.

Per-page "Set Up Development Environment" callouts in accounts.md now
point at the matching anchors (#rust-project, #typescript-project).
The <CodeTabs /> JSX wrapper was rendering broken in production — MDX's
parser couldn't handle the nested template-literal payloads with braces
inside, causing entire blocks to fall through to raw text. Replace all 7
<CodeTabs /> instances across the Quick Start pages with paired markdown
code fences (Rust first, then TypeScript) using the title= attribute to
keep the suggested filename visible.

- accounts.md: 2 CodeTabs blocks → 4 fences
- notes.md: 3 CodeTabs blocks → 6 fences
- read-storage.md: 2 CodeTabs blocks → 4 fences
- Removed the now-unused `import { CodeTabs } from '@site/src/components'`
  from each of the three files.

Code bodies preserved verbatim; only the surrounding wrapper changed.
npm run build passes with no new broken links on any changed page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant