Skip to content

Commit ff0edc5

Browse files
style: format markdown with prettier
1 parent 8bec3fb commit ff0edc5

File tree

5 files changed

+697
-631
lines changed

5 files changed

+697
-631
lines changed

docs/src/web-client/create_deploy_tutorial.md

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ First, we'll create a separate file for our blockchain logic. In the project roo
8383
mkdir -p lib
8484
```
8585

86-
{/* prettier-ignore */}
86+
{/_ prettier-ignore _/}
8787
<CodeSdkTabs example={{
88-
react: { code: `// lib/react/createMintConsume.tsx
88+
react: { code: `// lib/react/createMintConsume.tsx
8989
'use client';
9090

9191
import { MidenProvider, useMiden, useCreateWallet, useCreateFaucet } from '@miden-sdk/react';
@@ -115,29 +115,29 @@ export default function CreateMintConsume() {
115115
...<CreateMintConsumeInner />
116116
..</MidenProvider>
117117
.);
118-
}` },
119-
typescript: { code: `// lib/createMintConsume.ts
118+
}`},
119+
typescript: { code:`// lib/createMintConsume.ts
120120
export async function createMintConsume(): Promise<void> {
121-
if (typeof window === 'undefined') {
122-
console.warn('webClient() can only run in the browser');
123-
return;
124-
}
121+
if (typeof window === 'undefined') {
122+
console.warn('webClient() can only run in the browser');
123+
return;
124+
}
125125

126-
// dynamic import → only in the browser, so WASM is loaded client‑side
127-
const { WebClient } =
128-
await import('@miden-sdk/miden-sdk');
126+
// dynamic import → only in the browser, so WASM is loaded client‑side
127+
const { WebClient } =
128+
await import('@miden-sdk/miden-sdk');
129129

130-
// Connect to Miden testnet RPC endpoint
131-
const nodeEndpoint = 'https://rpc.testnet.miden.io';
132-
const client = await WebClient.createClient(nodeEndpoint);
130+
// Connect to Miden testnet RPC endpoint
131+
const nodeEndpoint = 'https://rpc.testnet.miden.io';
132+
const client = await WebClient.createClient(nodeEndpoint);
133133

134-
// 1. Sync with the latest blockchain state
135-
// This fetches the latest block header and state commitments
136-
const state = await client.syncState();
137-
console.log('Latest block number:', state.blockNum());
134+
// 1. Sync with the latest blockchain state
135+
// This fetches the latest block header and state commitments
136+
const state = await client.syncState();
137+
console.log('Latest block number:', state.blockNum());
138138

139-
// At this point, your client is connected and synchronized
140-
// Ready to create accounts and deploy contracts!
139+
// At this point, your client is connected and synchronized
140+
// Ready to create accounts and deploy contracts!
141141
}` },
142142
}} reactFilename="lib/react/createMintConsume.tsx" tsFilename="lib/createMintConsume.ts" />
143143

@@ -206,40 +206,40 @@ Now we'll create Alice's account. Let's create a **public** account so we can ea
206206

207207
Back in your library file, extend the function:
208208

209-
{/* prettier-ignore */}
209+
{/_ prettier-ignore _/}
210210
<CodeSdkTabs example={{
211-
react: { code: `const run = async () => {
211+
react: { code: `const run = async () => {
212212
.// 1. Create Alice's wallet (public, mutable)
213213
.console.log('Creating account for Alice…');
214214
.const alice = await createWallet({ storageMode: 'public' });
215215
.console.log('Alice ID:', alice.id().toString());
216216
};` },
217-
typescript: { code: `// lib/createMintConsume.ts
217+
typescript: { code: `// lib/createMintConsume.ts
218218
export async function createMintConsume(): Promise<void> {
219-
if (typeof window === 'undefined') {
220-
console.warn('webClient() can only run in the browser');
221-
return;
222-
}
219+
if (typeof window === 'undefined') {
220+
console.warn('webClient() can only run in the browser');
221+
return;
222+
}
223223

224-
const { WebClient, AccountStorageMode, AuthScheme } = await import(
225-
"@miden-sdk/miden-sdk"
226-
);
224+
const { WebClient, AccountStorageMode, AuthScheme } = await import(
225+
"@miden-sdk/miden-sdk"
226+
);
227227

228-
const nodeEndpoint = 'https://rpc.testnet.miden.io';
229-
const client = await WebClient.createClient(nodeEndpoint);
228+
const nodeEndpoint = 'https://rpc.testnet.miden.io';
229+
const client = await WebClient.createClient(nodeEndpoint);
230230

231-
// 1. Sync with the latest blockchain state
232-
const state = await client.syncState();
233-
console.log('Latest block number:', state.blockNum());
231+
// 1. Sync with the latest blockchain state
232+
const state = await client.syncState();
233+
console.log('Latest block number:', state.blockNum());
234234

235-
// 2. Create Alice's account
236-
console.log('Creating account for Alice…');
237-
const alice = await client.newWallet(
238-
AccountStorageMode.public(), // Public: account state is visible on-chain
239-
true, // Mutable: account code can be upgraded later
240-
AuthScheme.AuthRpoFalcon512 // Auth Scheme: RPO Falcon 512
241-
);
242-
console.log('Alice ID:', alice.id().toString());
235+
// 2. Create Alice's account
236+
console.log('Creating account for Alice…');
237+
const alice = await client.newWallet(
238+
AccountStorageMode.public(), // Public: account state is visible on-chain
239+
true, // Mutable: account code can be upgraded later
240+
AuthScheme.AuthRpoFalcon512 // Auth Scheme: RPO Falcon 512
241+
);
242+
console.log('Alice ID:', alice.id().toString());
243243
}` },
244244
}} reactFilename="lib/react/createMintConsume.tsx" tsFilename="lib/createMintConsume.ts" />
245245

@@ -249,29 +249,29 @@ A faucet in Miden is a special type of account that can mint new tokens. Think o
249249

250250
Add this code after creating Alice's account:
251251

252-
{/* prettier-ignore */}
252+
{/_ prettier-ignore _/}
253253
<CodeSdkTabs example={{
254-
react: { code: `// 2. Deploy a fungible faucet
254+
react: { code: `// 2. Deploy a fungible faucet
255255
console.log('Creating faucet…');
256256
const faucet = await createFaucet({
257-
.tokenSymbol: 'MID', // Token symbol (like ETH, BTC, etc.)
258-
.decimals: 8, // Decimals (8 means 1 MID = 100,000,000 base units)
257+
.tokenSymbol: 'MID', // Token symbol (like ETH, BTC, etc.)
258+
.decimals: 8, // Decimals (8 means 1 MID = 100,000,000 base units)
259259
.maxSupply: BigInt(1_000_000), // Max supply: total tokens that can ever be minted
260-
.storageMode: 'public', // Public: faucet operations are transparent
260+
.storageMode: 'public', // Public: faucet operations are transparent
261261
});
262262
console.log('Faucet account ID:', faucet.id().toString());
263263

264-
console.log('Setup complete.');` },
265-
typescript: { code: `// 3. Deploy a fungible faucet
264+
console.log('Setup complete.');`},
265+
typescript: { code:`// 3. Deploy a fungible faucet
266266
// A faucet is an account that can mint new tokens
267267
console.log('Creating faucet…');
268268
const faucetAccount = await client.newFaucet(
269-
AccountStorageMode.public(), // Public: faucet operations are transparent
270-
false, // Immutable: faucet rules cannot be changed
271-
"MID", // Token symbol (like ETH, BTC, etc.)
272-
8, // Decimals (8 means 1 MID = 100,000,000 base units)
273-
BigInt(1_000_000), // Max supply: total tokens that can ever be minted
274-
AuthScheme.AuthRpoFalcon512 // Auth Scheme: RPO Falcon 512
269+
AccountStorageMode.public(), // Public: faucet operations are transparent
270+
false, // Immutable: faucet rules cannot be changed
271+
"MID", // Token symbol (like ETH, BTC, etc.)
272+
8, // Decimals (8 means 1 MID = 100,000,000 base units)
273+
BigInt(1_000_000), // Max supply: total tokens that can ever be minted
274+
AuthScheme.AuthRpoFalcon512 // Auth Scheme: RPO Falcon 512
275275
);
276276
console.log('Faucet account ID:', faucetAccount.id().toString());
277277

@@ -299,9 +299,9 @@ In this tutorial, we've successfully:
299299

300300
Your final `lib/react/createMintConsume.tsx` (React) or `lib/createMintConsume.ts` (TypeScript) should look like:
301301

302-
{/* prettier-ignore */}
302+
{/_ prettier-ignore _/}
303303
<CodeSdkTabs example={{
304-
react: { code: `'use client';
304+
react: { code: `'use client';
305305

306306
import { MidenProvider, useMiden, useCreateWallet, useCreateFaucet } from '@miden-sdk/react';
307307

@@ -344,47 +344,47 @@ export default function CreateMintConsume() {
344344
...<CreateMintConsumeInner />
345345
..</MidenProvider>
346346
.);
347-
}` },
348-
typescript: { code: `// lib/createMintConsume.ts
347+
}`},
348+
typescript: { code:`// lib/createMintConsume.ts
349349
export async function createMintConsume(): Promise<void> {
350-
if (typeof window === 'undefined') {
351-
console.warn('webClient() can only run in the browser');
352-
return;
353-
}
350+
if (typeof window === 'undefined') {
351+
console.warn('webClient() can only run in the browser');
352+
return;
353+
}
354354

355-
// dynamic import → only in the browser, so WASM is loaded client‑side
356-
const { WebClient, AccountStorageMode, AuthScheme } =
357-
await import('@miden-sdk/miden-sdk');
355+
// dynamic import → only in the browser, so WASM is loaded client‑side
356+
const { WebClient, AccountStorageMode, AuthScheme } =
357+
await import('@miden-sdk/miden-sdk');
358358

359-
const nodeEndpoint = 'https://rpc.testnet.miden.io';
360-
const client = await WebClient.createClient(nodeEndpoint);
359+
const nodeEndpoint = 'https://rpc.testnet.miden.io';
360+
const client = await WebClient.createClient(nodeEndpoint);
361361

362-
// 1. Sync with the latest blockchain state
363-
const state = await client.syncState();
364-
console.log('Latest block number:', state.blockNum());
362+
// 1. Sync with the latest blockchain state
363+
const state = await client.syncState();
364+
console.log('Latest block number:', state.blockNum());
365365

366-
// 2. Create Alice's account
367-
console.log('Creating account for Alice…');
368-
const alice = await client.newWallet(
369-
AccountStorageMode.public(),
370-
true,
371-
AuthScheme.AuthRpoFalcon512,
372-
);
373-
console.log('Alice ID:', alice.id().toString());
374-
375-
// 3. Deploy a fungible faucet
376-
console.log('Creating faucet…');
377-
const faucet = await client.newFaucet(
378-
AccountStorageMode.public(),
379-
false,
380-
'MID',
381-
8,
382-
BigInt(1_000_000),
383-
AuthScheme.AuthRpoFalcon512,
384-
);
385-
console.log('Faucet ID:', faucet.id().toString());
366+
// 2. Create Alice's account
367+
console.log('Creating account for Alice…');
368+
const alice = await client.newWallet(
369+
AccountStorageMode.public(),
370+
true,
371+
AuthScheme.AuthRpoFalcon512,
372+
);
373+
console.log('Alice ID:', alice.id().toString());
374+
375+
// 3. Deploy a fungible faucet
376+
console.log('Creating faucet…');
377+
const faucet = await client.newFaucet(
378+
AccountStorageMode.public(),
379+
false,
380+
'MID',
381+
8,
382+
BigInt(1_000_000),
383+
AuthScheme.AuthRpoFalcon512,
384+
);
385+
console.log('Faucet ID:', faucet.id().toString());
386386

387-
console.log('Setup complete.');
387+
console.log('Setup complete.');
388388
}` },
389389
}} reactFilename="lib/react/createMintConsume.tsx" tsFilename="lib/createMintConsume.ts" />
390390

0 commit comments

Comments
 (0)