@miden-sdk/miden-sdk 0.15.3 → 0.15.5

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.
Files changed (47) hide show
  1. package/README.md +85 -0
  2. package/dist/mt/{Cargo-D2qNRrNR.js → Cargo-C001gt8g.js} +587 -90
  3. package/dist/mt/Cargo-C001gt8g.js.map +1 -0
  4. package/dist/mt/api-types.d.ts +189 -0
  5. package/dist/mt/assets/miden_client_web.wasm +0 -0
  6. package/dist/mt/crates/miden_client_web.d.ts +153 -3
  7. package/dist/mt/docs-entry.d.ts +3 -0
  8. package/dist/mt/eager.js +1 -1
  9. package/dist/mt/index.d.ts +3 -0
  10. package/dist/mt/index.js +302 -13
  11. package/dist/mt/index.js.map +1 -1
  12. package/dist/mt/wasm.js +1 -1
  13. package/dist/mt/workerHelpers.js +1 -1
  14. package/dist/mt/workers/{Cargo-D2qNRrNR-n_GEbq73.js → Cargo-C001gt8g-B8wBADUI.js} +587 -90
  15. package/dist/mt/workers/Cargo-C001gt8g-B8wBADUI.js.map +1 -0
  16. package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
  17. package/dist/mt/workers/web-client-methods-worker.js +589 -90
  18. package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
  19. package/dist/mt/workers/web-client-methods-worker.module.js +1 -1
  20. package/dist/mt/workers/web-client-methods-worker.module.js.map +1 -1
  21. package/dist/mt/workers/workerHelpers.js +1 -1
  22. package/dist/st/{Cargo-BP7-0qVT.js → Cargo-CR1mzjgg.js} +593 -98
  23. package/dist/st/Cargo-CR1mzjgg.js.map +1 -0
  24. package/dist/st/api-types.d.ts +189 -0
  25. package/dist/st/assets/miden_client_web.wasm +0 -0
  26. package/dist/st/crates/miden_client_web.d.ts +153 -3
  27. package/dist/st/docs-entry.d.ts +3 -0
  28. package/dist/st/eager.js +1 -1
  29. package/dist/st/index.d.ts +3 -0
  30. package/dist/st/index.js +302 -13
  31. package/dist/st/index.js.map +1 -1
  32. package/dist/st/wasm.js +1 -1
  33. package/dist/st/workers/{Cargo-BP7-0qVT-CmfAy6bf.js → Cargo-CR1mzjgg-DeDmKA4W.js} +593 -98
  34. package/dist/st/workers/Cargo-CR1mzjgg-DeDmKA4W.js.map +1 -0
  35. package/dist/st/workers/assets/miden_client_web.wasm +0 -0
  36. package/dist/st/workers/web-client-methods-worker.js +595 -98
  37. package/dist/st/workers/web-client-methods-worker.js.map +1 -1
  38. package/dist/st/workers/web-client-methods-worker.module.js +1 -1
  39. package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
  40. package/js/node-index.js +4 -0
  41. package/js/resources/transactions.js +289 -12
  42. package/js/standalone.js +61 -0
  43. package/package.json +4 -4
  44. package/dist/mt/Cargo-D2qNRrNR.js.map +0 -1
  45. package/dist/mt/workers/Cargo-D2qNRrNR-n_GEbq73.js.map +0 -1
  46. package/dist/st/Cargo-BP7-0qVT.js.map +0 -1
  47. package/dist/st/workers/Cargo-BP7-0qVT-CmfAy6bf.js.map +0 -1
package/README.md CHANGED
@@ -423,6 +423,26 @@ console.log(faucet.id().toString());
423
423
  console.log(faucet.isFaucet()); // true
424
424
  ```
425
425
 
426
+ ### Read Faucet Metadata
427
+
428
+ `BasicFungibleFaucetComponent` extracts the on-chain token metadata from a faucet account. The same
429
+ component backs both basic and network-style faucets, so it works for either:
430
+
431
+ ```typescript
432
+ import { BasicFungibleFaucetComponent } from "@miden-sdk/miden-sdk";
433
+
434
+ const faucet = BasicFungibleFaucetComponent.fromAccount(account);
435
+
436
+ faucet.symbol().toString(); // "DAG"
437
+ faucet.tokenName(); // "DAG Token"
438
+ faucet.decimals(); // 8
439
+ faucet.maxSupply().toString(); // "10000000"
440
+ faucet.tokenSupply().toString(); // amount minted so far, e.g. "0"
441
+ faucet.description(); // string | undefined
442
+ faucet.logoUri(); // string | undefined
443
+ faucet.externalLink(); // string | undefined
444
+ ```
445
+
426
446
  ### Send Tokens
427
447
 
428
448
  ```typescript
@@ -452,6 +472,38 @@ const balance = await client.accounts.getBalance(wallet, dagToken);
452
472
  console.log(`Balance: ${balance}`);
453
473
  ```
454
474
 
475
+ ### Batch Operations
476
+
477
+ Submit multiple operations against a single account as one atomic batch — every transaction in the batch lands together or none does. Each operation builds its own `TransactionRequest` internally; you don't have to assemble or serialize them yourself.
478
+
479
+ ```typescript
480
+ const { blockNumber } = await client.transactions.batch({
481
+ account: wallet,
482
+ operations: [
483
+ { kind: "send", to: alice, token: dagToken, amount: 50n, type: "public" },
484
+ { kind: "send", to: bob, token: dagToken, amount: 30n, type: "public" },
485
+ { kind: "consume", notes: pendingNotes },
486
+ ],
487
+ waitForConfirmation: true,
488
+ });
489
+ console.log(`Batch landed in block ${blockNumber}`);
490
+ ```
491
+
492
+ Operations are discriminated by `kind`: `"send"`, `"mint"`, `"consume"`, `"swap"`, `"execute"`, and `"custom"` (escape hatch for a pre-built `TransactionRequest`). The shape of each operation mirrors the singular options object (`SendOptions`, `MintOptions`, …) minus the `account` field, which is set once at the batch level.
493
+
494
+ V1 supports only same-account batches — every operation must execute against the `account` passed at the top level. Mixing accounts in one batch is not supported.
495
+
496
+ For callers that already hold pre-built `TransactionRequest`s, `submitBatch` skips the high-level builders:
497
+
498
+ ```typescript
499
+ const { blockNumber } = await client.transactions.submitBatch(wallet, [
500
+ request1,
501
+ request2,
502
+ ]);
503
+ ```
504
+
505
+ The V1 batch primitive returns only the block number — there are no per-tx ids in the result. `waitForConfirmation` polls local sync height until it reaches `blockNumber` (rather than per-tx polling like singular `send` / `consume`).
506
+
455
507
  ### Partial-Swap (PSWAP) Orders
456
508
 
457
509
  A partial-swap note offers one asset for another and can be filled by multiple
@@ -491,6 +543,39 @@ await client.pswap.cancelByOrder({ orderId, waitForConfirmation: true });
491
543
  `client.pswap.lineage(orderId)` returns one order's lineage, or `null` if it is
492
544
  not tracked.
493
545
 
546
+ ### Bridge out (AggLayer)
547
+
548
+ `client.transactions.bridge(...)` bridges a fungible asset out to another network via the AggLayer. It emits a single public B2AGG note that the bridge account consumes, burning the asset so it can be claimed at the destination Ethereum address on the AggLayer-assigned network.
549
+
550
+ ```typescript
551
+ await client.transactions.bridge({
552
+ account: wallet, // sender (executes the transaction)
553
+ bridgeAccount: bridge, // consumes the note and burns the asset
554
+ token: dagToken, // faucet of the asset being bridged
555
+ amount: 100n,
556
+ destinationNetwork: 1, // AggLayer-assigned network id
557
+ destinationAddress: "0x000000000000000000000000000000000000dEaD"
558
+ });
559
+ ```
560
+
561
+ The 20-byte destination is also available as an `EthAddress` (`EthAddress.fromHex("0x…")`) for the lower-level builders `Note.createB2AggNote(...)` and `client.newB2AggTransactionRequest(...)`.
562
+
563
+ ### Network Notes
564
+
565
+ A network note is a Public note carrying a `NetworkAccountTarget` attachment; a public network account auto-consumes it once the note lands on-chain — no manual `consume` call needed on the target side.
566
+
567
+ ```typescript
568
+ const { txId, note } = await client.transactions.createNetworkNote({
569
+ account: senderId,
570
+ target: networkAccountId,
571
+ script: myNoteScript, // or: recipient: myRecipient
572
+ waitForConfirmation: true,
573
+ });
574
+ console.log(note.isNetworkNote()); // true
575
+ ```
576
+
577
+ Provide exactly one of `script` or `recipient`. Notes are always Public — the attachment, not the tag, is what a network account matches on. The standalone `buildNetworkNote(opts)` builds the same note without submitting.
578
+
494
579
  ### Cleanup
495
580
 
496
581
  When you're finished using a MidenClient instance, call `terminate()` to release its Web Worker: