create-miden-app 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-miden-app",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A Miden Project Scaffold Template",
5
5
  "bin": {
6
6
  "create-miden-app": "cli.js"
@@ -10,7 +10,8 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@demox-labs/miden-sdk": "^0.11.11",
13
+ "@miden-sdk/miden-sdk": "^0.13.0",
14
+ "dexie": "^4.2.1",
14
15
  "react": "^19.1.1",
15
16
  "react-dom": "^19.1.1"
16
17
  },
@@ -4,18 +4,21 @@ import {
4
4
  NoteType,
5
5
  ConsumableNoteRecord,
6
6
  AccountId,
7
- } from "@demox-labs/miden-sdk";
7
+ AuthScheme,
8
+ } from "@miden-sdk/miden-sdk";
8
9
 
9
10
  export async function demo() {
10
11
  // Initialize client to connect with the Miden Testnet.
11
12
  // NOTE: The client is our entry point to the Miden network.
12
13
  // All interactions with the network go through the client.
13
- const nodeEndpoint = "https://rpc.testnet.miden.io:443";
14
+ const nodeEndpoint = "https://rpc.devnet.miden.io:443";
15
+
16
+ // Initialize client
14
17
  const client = await WebClient.createClient(nodeEndpoint);
15
18
  await client.syncState();
16
19
 
17
20
  // Creating Alice's account
18
- const alice = await client.newWallet(AccountStorageMode.public(), true);
21
+ const alice = await client.newWallet(AccountStorageMode.public(), true, AuthScheme.AuthRpoFalcon512);
19
22
  console.log("Alice's account ID:", alice.id().toString());
20
23
 
21
24
  // Creating a faucet account
@@ -27,7 +30,8 @@ export async function demo() {
27
30
  false, // Mutable: account code cannot be upgraded later
28
31
  symbol, // Symbol of the token
29
32
  decimals, // Number of decimals
30
- initialSupply // Initial supply of tokens
33
+ initialSupply, // Initial supply of tokens
34
+ AuthScheme.AuthRpoFalcon512 // Authentication scheme
31
35
  );
32
36
  console.log("Faucet account ID:", faucet.id().toString());
33
37
 
@@ -41,14 +45,13 @@ export async function demo() {
41
45
  NoteType.Public, // Note visibility (public = on-chain)
42
46
  BigInt(1000) // Amount to mint (in base units)
43
47
  );
44
- const mintTx = await client.newTransaction(faucet.id(), mintTxRequest);
45
- await client.submitTransaction(mintTx);
46
-
47
- console.log(
48
- "Mint transaction submitted successfully, ID:",
49
- mintTx.executedTransaction().id().toHex()
48
+ const mintTxId = await client.submitNewTransaction(
49
+ faucet.id(),
50
+ mintTxRequest
50
51
  );
51
52
 
53
+ console.log("Mint transaction submitted successfully, ID:", mintTxId.toHex());
54
+
52
55
  await client.syncState();
53
56
 
54
57
  let consumableNotes: ConsumableNoteRecord[] = [];
@@ -60,18 +63,20 @@ export async function demo() {
60
63
  await new Promise((resolve) => setTimeout(resolve, 3000));
61
64
  }
62
65
 
63
- const noteIds = consumableNotes.map((note) =>
64
- note.inputNoteRecord().id().toString()
66
+ const notes = consumableNotes.map((note) =>
67
+ note.inputNoteRecord().toNote()
65
68
  );
66
69
 
67
70
  // Create transaction request to consume notes
68
71
  // NOTE: This transaction will consume the notes and add the fungible asset to Alice's vault
69
- const consumeTxRequest = client.newConsumeTransactionRequest(noteIds);
70
- const consumeTx = await client.newTransaction(alice.id(), consumeTxRequest);
71
- await client.submitTransaction(consumeTx);
72
+ const consumeTxRequest = client.newConsumeTransactionRequest(notes);
73
+ const consumeTxId = await client.submitNewTransaction(
74
+ alice.id(),
75
+ consumeTxRequest
76
+ );
72
77
  console.log(
73
78
  "Consume transaction submitted successfully, ID:",
74
- consumeTx.executedTransaction().id().toHex()
79
+ consumeTxId.toHex()
75
80
  );
76
81
 
77
82
  console.log(
@@ -94,9 +99,8 @@ export async function demo() {
94
99
  BigInt(100) // Amount to send
95
100
  );
96
101
 
97
- const sendTx = await client.newTransaction(alice.id(), sendTxRequest);
98
- await client.submitTransaction(sendTx);
99
- console.log("Send transaction submitted successfully!");
102
+ const sendTxId = await client.submitNewTransaction(alice.id(), sendTxRequest);
103
+ console.log("Send transaction submitted successfully, ID:", sendTxId.toHex());
100
104
 
101
105
  await client.syncState();
102
106
  }
@@ -2,12 +2,20 @@ import { defineConfig } from "vite";
2
2
  import react from "@vitejs/plugin-react";
3
3
  import wasm from "vite-plugin-wasm";
4
4
  import topLevelAwait from "vite-plugin-top-level-await";
5
+ import path from "path";
5
6
 
6
7
  // https://vite.dev/config/
7
8
  export default defineConfig({
8
9
  plugins: [react(), wasm(), topLevelAwait()],
10
+ resolve: {
11
+ alias: {
12
+ // Help resolve dexie when imported from linked packages
13
+ dexie: path.resolve(__dirname, "node_modules/dexie"),
14
+ },
15
+ },
9
16
  optimizeDeps: {
10
- exclude: ["@demox-labs/miden-sdk"],
17
+ exclude: ["@miden-sdk/miden-sdk"],
18
+ include: ["dexie"],
11
19
  },
12
20
  server: {
13
21
  headers: {