@@ -113,12 +113,14 @@ import { NoteType } from "@demox-labs/miden-sdk";
113113// ...
114114
115115// 7. Send tokens from Alice to Bob
116- const bobAccountId = " 0x599a54603f0cf9000000ed7a11e379" ;
116+ const bobAccountId = Address .fromBech32 (
117+ ' mtst1apve54rq8ux0jqqqqrkh5y0r0y8cwza6_qruqqypuyph' ,
118+ ).accountId ();
117119console .log (" Sending tokens to Bob's account..." );
118120
119121const sendTxRequest = client .newSendTransactionRequest (
120- alice .id (), // Sender account
121- AccountId . fromHex ( bobAccountId ), // Recipient account
122+ alice .id (), // Sender account ID
123+ bobAccountId , // Recipient account ID
122124 faucet .id (), // Asset ID (faucet that created the tokens)
123125 NoteType .Public , // Note visibility
124126 BigInt (100 ), // Amount to send
@@ -152,23 +154,23 @@ export async function createMintConsume(): Promise<void> {
152154 }
153155
154156 // dynamic import → only in the browser, so WASM is loaded client‑side
155- const { WebClient, AccountStorageMode, AccountId, NoteType } = await import (
157+ const { WebClient, AccountStorageMode, NoteType, Address } = await import (
156158 ' @demox-labs/miden-sdk'
157159 );
158160
159161 const nodeEndpoint = ' https://rpc.testnet.miden.io' ;
160162 const client = await WebClient .createClient (nodeEndpoint );
161163
162- // 1. Sync and log block
164+ // 1. Sync with the latest blockchain state
163165 const state = await client .syncState ();
164166 console .log (' Latest block number:' , state .blockNum ());
165167
166- // 2. Create Alice’ s account
168+ // 2. Create Alice' s account
167169 console .log (' Creating account for Alice…' );
168170 const alice = await client .newWallet (AccountStorageMode .public (), true , 0 );
169171 console .log (' Alice ID:' , alice .id ().toString ());
170172
171- // 3. Deploy faucet
173+ // 3. Deploy a fungible faucet
172174 console .log (' Creating faucet…' );
173175 const faucet = await client .newFaucet (
174176 AccountStorageMode .public (),
@@ -185,7 +187,7 @@ export async function createMintConsume(): Promise<void> {
185187 // 4. Mint tokens to Alice
186188 await client .syncState ();
187189
188- console .log (' Minting 1000 tokens to Alice...' );
190+ console .log (' Minting tokens to Alice...' );
189191 const mintTxRequest = client .newMintTransactionRequest (
190192 alice .id (),
191193 faucet .id (),
@@ -204,7 +206,7 @@ export async function createMintConsume(): Promise<void> {
204206 const mintedNoteIds = mintedNotes .map ((n ) =>
205207 n .inputNoteRecord ().id ().toString (),
206208 );
207- console .log (' Consumable note IDs:' , mintedNoteIds );
209+ console .log (' Minted note IDs:' , mintedNoteIds );
208210
209211 // 6. Consume minted notes
210212 console .log (' Consuming minted notes...' );
@@ -216,11 +218,13 @@ export async function createMintConsume(): Promise<void> {
216218 console .log (' Notes consumed.' );
217219
218220 // 7. Send tokens to Bob
219- const bobAccountId = ' 0x599a54603f0cf9000000ed7a11e379' ;
221+ const bobAccountId = Address .fromBech32 (
222+ ' mtst1apve54rq8ux0jqqqqrkh5y0r0y8cwza6_qruqqypuyph' ,
223+ ).accountId ();
220224 console .log (" Sending tokens to Bob's account..." );
221225 const sendTxRequest = client .newSendTransactionRequest (
222226 alice .id (),
223- AccountId . fromHex ( bobAccountId ) ,
227+ bobAccountId ,
224228 faucet .id (),
225229 NoteType .Public ,
226230 BigInt (100 ),
0 commit comments