@miden-sdk/miden-sdk 0.15.5 → 0.15.7
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/README.md +28 -0
- package/dist/mt/{Cargo-C001gt8g.js → Cargo-CnGom-_z.js} +244 -86
- package/dist/mt/Cargo-CnGom-_z.js.map +1 -0
- package/dist/mt/api-types.d.ts +120 -0
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +80 -1
- package/dist/mt/docs-entry.d.ts +3 -0
- package/dist/mt/eager.js +1 -1
- package/dist/mt/index.js +252 -5
- package/dist/mt/index.js.map +1 -1
- package/dist/mt/wasm.js +1 -1
- package/dist/mt/workerHelpers.js +1 -1
- package/dist/mt/workers/{Cargo-C001gt8g-B8wBADUI.js → Cargo-CnGom-_z-X_3VwTbo.js} +244 -86
- package/dist/mt/workers/Cargo-CnGom-_z-X_3VwTbo.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +245 -86
- package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js.map +1 -1
- package/dist/mt/workers/workerHelpers.js +1 -1
- package/dist/st/{Cargo-CR1mzjgg.js → Cargo-DR9fiMbE.js} +253 -96
- package/dist/st/Cargo-DR9fiMbE.js.map +1 -0
- package/dist/st/api-types.d.ts +120 -0
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +80 -1
- package/dist/st/docs-entry.d.ts +3 -0
- package/dist/st/eager.js +1 -1
- package/dist/st/index.js +252 -5
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-CR1mzjgg-DeDmKA4W.js → Cargo-DR9fiMbE-C0G0clA_.js} +253 -96
- package/dist/st/workers/Cargo-DR9fiMbE-C0G0clA_.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +254 -96
- package/dist/st/workers/web-client-methods-worker.js.map +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/node-index.js +1 -0
- package/js/resources/transactions.js +251 -4
- package/package.json +4 -4
- package/dist/mt/Cargo-C001gt8g.js.map +0 -1
- package/dist/mt/workers/Cargo-C001gt8g-B8wBADUI.js.map +0 -1
- package/dist/st/Cargo-CR1mzjgg.js.map +0 -1
- package/dist/st/workers/Cargo-CR1mzjgg-DeDmKA4W.js.map +0 -1
package/README.md
CHANGED
|
@@ -504,6 +504,21 @@ const { blockNumber } = await client.transactions.submitBatch(wallet, [
|
|
|
504
504
|
|
|
505
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
506
|
|
|
507
|
+
### Manual Transaction Lifecycle
|
|
508
|
+
|
|
509
|
+
`client.transactions.submit(account, request)` runs execute → prove → submit → apply in one call. To drive the stages yourself — benchmarking each step or handling errors per stage — `executeRequest` returns a staged handle you advance one step at a time. Each stage carries its own context, so you never re-thread the result or block number:
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
const executed = await client.transactions.executeRequest(wallet, request); // local only
|
|
513
|
+
const proven = await executed.prove(); // optional { prover } override
|
|
514
|
+
const submitted = await proven.submit(); // network; submitted.blockNumber
|
|
515
|
+
await submitted.apply(); // persist + fire observers
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Nothing is persisted until `apply` runs — stopping after `submit()` leaves the local store unaware of the transaction until the next sync. `submitted.waitForConfirmation()` blocks until the transaction commits on-chain.
|
|
519
|
+
|
|
520
|
+
To submit a proof produced somewhere that shares nothing with this client (a detached prover), pass it back in with `client.transactions.submitProven(proof, result)`, which returns the same submitted handle.
|
|
521
|
+
|
|
507
522
|
### Partial-Swap (PSWAP) Orders
|
|
508
523
|
|
|
509
524
|
A partial-swap note offers one asset for another and can be filled by multiple
|
|
@@ -576,6 +591,19 @@ console.log(note.isNetworkNote()); // true
|
|
|
576
591
|
|
|
577
592
|
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
593
|
|
|
594
|
+
To create the receiving account, build a **public** account carrying the network-account auth component — its note-script allowlist tells the node which notes the account may auto-consume:
|
|
595
|
+
|
|
596
|
+
```typescript
|
|
597
|
+
const auth = AccountComponent.createNetworkAuth([myNoteScript.root()]);
|
|
598
|
+
const { account } = new AccountBuilder(seed)
|
|
599
|
+
.storageMode(AccountStorageMode.public())
|
|
600
|
+
.withComponent(myComponent)
|
|
601
|
+
.withAuthComponent(auth)
|
|
602
|
+
.build();
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
The allowlist must be non-empty. Transaction scripts are forbidden unless allowlisted via the optional second argument (`TransactionScript.root()`); the component bumps the nonce itself, so the account deploys via a scriptless transaction. Readback: `account.isNetworkAccount()` and `account.networkNoteAllowlist()`.
|
|
606
|
+
|
|
579
607
|
### Cleanup
|
|
580
608
|
|
|
581
609
|
When you're finished using a MidenClient instance, call `terminate()` to release its Web Worker:
|