You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(web-client): migrate all tutorials to MidenClient API (#164)
* chore(web-client): update SDK dependency to local build
* feat(web-client): migrate counter contract tutorial to MidenClient API
* feat(web-client): rewrite FPI tutorial as self-contained MidenClient example
* docs: update web-client tutorials to use MidenClient API
* fix(docs): format markdown files with prettier
* refactor(tutorials): replace AccountType string literals with enum references
* refactor(tutorials): replace NoteVisibility and StorageMode string literals with enum references
* refactor(tutorials): remove forced .toHex()/.toString() conversions in API calls
* refactor(tutorials): migrate web-client/lib TypeScript files to MidenClient API
- Replace WebClient with MidenClient.create()
- Replace syncState() with sync()
- Replace newWallet/newFaucet with client.accounts.create()
- Replace manual tx request builders with client.transactions.mint/consume/send/submit()
- Replace getConsumableNotes() with client.notes.listAvailable()
- Pass account objects directly instead of .id() to transaction methods
- Use NoteVisibility enum instead of 'public' string literals
- Update React files to pass account objects instead of string IDs
* refactor(docs): pass account objects and NoteVisibility enum in TypeScript code snippets
* fix(web-client): use localhost node and pass account objects directly to SDK
* refactor(tutorials): use send({ authenticated: false }) + consume() for unauthenticated notes
Replace the manual TransactionRequestBuilder loop with the new send() API:
- unauthenticatedNoteTransfer.ts: replace 10-line builder pattern with
send({ authenticated: false }) + consume({ notes: [note] })
- unauthenticatedNoteTransfer.tsx: replace useInternalTransfer/transferChain
with explicit useSend + useConsume loop
- unauthenticated_note_how_to.md: update both TypeScript and React code snippets
* refactor(tutorials): use proverUrl shorthand at client creation
Replace per-call TransactionProver.newLocalProver() with proverUrl: 'local'
in MidenClient.create(). Removes the TransactionProver import from tutorial files.
* refactor(tutorials): use rpcUrl shorthand 'local' in TS client tutorials
@@ -11,7 +11,7 @@ In this tutorial, we will interact with a counter contract already deployed on c
11
11
12
12
Using a script, we will invoke the increment function within the counter contract to update the count. This tutorial provides a foundational understanding of interacting with custom smart contracts on Miden.
13
13
14
-
## What we'llcover
14
+
## What we'llcover
15
15
16
16
- Interacting with a custom smart contract on Miden
17
17
- Calling procedures in an account from a script
@@ -96,7 +96,7 @@ export default function Home() {
96
96
}
97
97
```
98
98
99
-
## Step 3 — Incrementing the Count of the Counter Contract
99
+
## Step 3 — Incrementing the Count of the Counter Contract
100
100
101
101
Create the file `lib/incrementCounterContract.ts` and add the following code.
102
102
@@ -117,139 +117,117 @@ export async function incrementCounterContract(): Promise<void> {
117
117
118
118
// dynamic import → only in the browser, so WASM is loaded client‑side
// Here we get the first Word from storage of the counter contract
255
233
// A word is comprised of 4 Felts, 2**64 - 2**32 + 1
@@ -343,6 +321,58 @@ This `NoAuth` component allows any user to interact with the smart contract with
343
321
344
322
**Note**: _Adding the `account::incr_nonce` to a state changing procedure allows any user to call the procedure._
345
323
324
+
### Compiling the account component
325
+
326
+
Use `client.compile.component()` to compile MASM code and its storage slots into an `AccountComponent`. Each call creates a fresh compiler instance so compilations are fully independent:
Use `client.accounts.create()` with `type: AccountType.ImmutableContract` to build and register the contract. You must supply a `seed` (for deterministic ID derivation) and a raw `AuthSecretKey` — the client stores the key automatically:
0 commit comments