@miden-sdk/miden-sdk 0.15.0-alpha.5 → 0.15.0-alpha.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/dist/mt/{Cargo-smJQCGjz.js → Cargo-C9UbiAcT.js} +62 -6
- package/dist/mt/{Cargo-smJQCGjz.js.map → Cargo-C9UbiAcT.js.map} +1 -1
- package/dist/mt/api-types.d.ts +6 -2
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +31 -1
- package/dist/mt/eager.js +2 -2
- package/dist/mt/index.d.ts +2 -1
- package/dist/mt/index.js +477 -375
- 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-smJQCGjz-q4GYXDiD.js → Cargo-C9UbiAcT-Z344cyB1.js} +62 -6
- package/dist/mt/workers/{Cargo-smJQCGjz-q4GYXDiD.js.map → Cargo-C9UbiAcT-Z344cyB1.js.map} +1 -1
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +118 -7
- package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js +55 -2
- 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-CG4XszZo.js → Cargo-OZMlHpic.js} +24 -2
- package/dist/st/{Cargo-CG4XszZo.js.map → Cargo-OZMlHpic.js.map} +1 -1
- package/dist/st/api-types.d.ts +6 -2
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +15 -1
- package/dist/st/eager.js +2 -2
- package/dist/st/index.d.ts +2 -1
- package/dist/st/index.js +477 -375
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-CG4XszZo-S7EHAZSa.js → Cargo-OZMlHpic-DZjvJlWc.js} +24 -2
- package/dist/st/workers/{Cargo-CG4XszZo-S7EHAZSa.js.map → Cargo-OZMlHpic-DZjvJlWc.js.map} +1 -1
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +79 -4
- package/dist/st/workers/web-client-methods-worker.js.map +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js +55 -2
- package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/client.js +24 -5
- package/js/node/napi-compat.js +7 -3
- package/js/resources/transactions.js +4 -1
- package/package.json +4 -4
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
async function loadWasm() {
|
|
6
6
|
let wasmModule;
|
|
7
7
|
if (!undefined || (undefined && !undefined.SSR)) {
|
|
8
|
-
wasmModule = await Promise.resolve().then(function () { return
|
|
8
|
+
wasmModule = await Promise.resolve().then(function () { return CargoC9UbiAcT; });
|
|
9
9
|
// The Cargo glue's __wbg_init TLA is stripped by the rollup build to
|
|
10
10
|
// prevent blocking WKWebView module evaluation. Call it explicitly here
|
|
11
11
|
// with the WASM URL that the Cargo glue pre-resolves (relative to its
|
|
@@ -45,6 +45,10 @@ const MethodName = Object.freeze({
|
|
|
45
45
|
SUBMIT_NEW_TRANSACTION_WITH_PROVER_MOCK: "submitNewTransactionWithProverMock",
|
|
46
46
|
SYNC_STATE: "syncState",
|
|
47
47
|
SYNC_STATE_MOCK: "syncStateMock",
|
|
48
|
+
SYNC_CHAIN: "syncChain",
|
|
49
|
+
SYNC_CHAIN_MOCK: "syncChainMock",
|
|
50
|
+
SYNC_NOTE_TRANSPORT: "syncNoteTransport",
|
|
51
|
+
SYNC_NOTE_TRANSPORT_MOCK: "syncNoteTransportMock",
|
|
48
52
|
});
|
|
49
53
|
|
|
50
54
|
let wasmModule$1 = null;
|
|
@@ -210,6 +214,14 @@ const methodHandlers = {
|
|
|
210
214
|
const serializedSyncSummary = syncSummary.serialize();
|
|
211
215
|
return serializedSyncSummary.buffer;
|
|
212
216
|
},
|
|
217
|
+
[MethodName.SYNC_NOTE_TRANSPORT]: async () => {
|
|
218
|
+
await wasmWebClient.syncNoteTransportImpl();
|
|
219
|
+
},
|
|
220
|
+
[MethodName.SYNC_CHAIN]: async () => {
|
|
221
|
+
const syncSummary = await wasmWebClient.syncChainImpl();
|
|
222
|
+
const serializedSyncSummary = syncSummary.serialize();
|
|
223
|
+
return serializedSyncSummary.buffer;
|
|
224
|
+
},
|
|
213
225
|
[MethodName.APPLY_TRANSACTION]: async (args) => {
|
|
214
226
|
const wasm = await getWasmOrThrow();
|
|
215
227
|
const [serializedTransactionResult, submissionHeight] = args;
|
|
@@ -353,6 +365,36 @@ methodHandlers[MethodName.SYNC_STATE_MOCK] = async (args) => {
|
|
|
353
365
|
return await methodHandlers[MethodName.SYNC_STATE]();
|
|
354
366
|
};
|
|
355
367
|
|
|
368
|
+
methodHandlers[MethodName.SYNC_CHAIN_MOCK] = async (args) => {
|
|
369
|
+
let [serializedMockChain, serializedMockNoteTransportNode] = args;
|
|
370
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
371
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
372
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
373
|
+
: null;
|
|
374
|
+
await wasmWebClient.createMockClient(
|
|
375
|
+
wasmSeed,
|
|
376
|
+
serializedMockChain,
|
|
377
|
+
serializedMockNoteTransportNode
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
return await methodHandlers[MethodName.SYNC_CHAIN]();
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
methodHandlers[MethodName.SYNC_NOTE_TRANSPORT_MOCK] = async (args) => {
|
|
384
|
+
let [serializedMockChain, serializedMockNoteTransportNode] = args;
|
|
385
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
386
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
387
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
388
|
+
: null;
|
|
389
|
+
await wasmWebClient.createMockClient(
|
|
390
|
+
wasmSeed,
|
|
391
|
+
serializedMockChain,
|
|
392
|
+
serializedMockNoteTransportNode
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
return await methodHandlers[MethodName.SYNC_NOTE_TRANSPORT]();
|
|
396
|
+
};
|
|
397
|
+
|
|
356
398
|
methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_MOCK] = async (args) => {
|
|
357
399
|
const wasm = await getWasmOrThrow();
|
|
358
400
|
let serializedMockNoteTransportNode = args.pop();
|
|
@@ -490,13 +532,24 @@ async function processMessage(event) {
|
|
|
490
532
|
self.postMessage({ ready: true });
|
|
491
533
|
return;
|
|
492
534
|
} else if (action === WorkerAction.INIT_MOCK) {
|
|
493
|
-
const [seed, logLevel] = args;
|
|
535
|
+
const [seed, logLevel, numThreads] = args;
|
|
494
536
|
const wasm = await getWasmOrThrow();
|
|
495
537
|
|
|
496
538
|
if (logLevel) {
|
|
497
539
|
wasm.setupLogging(logLevel);
|
|
498
540
|
}
|
|
499
541
|
|
|
542
|
+
// Initialize rayon's pool inside THIS worker's WASM instance — same
|
|
543
|
+
// rationale as the INIT path above: all proving executes here, and a
|
|
544
|
+
// pool initialized in any other instance does not parallelize it.
|
|
545
|
+
if (
|
|
546
|
+
numThreads &&
|
|
547
|
+
numThreads > 1 &&
|
|
548
|
+
typeof wasm.initThreadPool === "function"
|
|
549
|
+
) {
|
|
550
|
+
await wasm.initThreadPool(numThreads);
|
|
551
|
+
}
|
|
552
|
+
|
|
500
553
|
wasmWebClient = new wasm.WebClient();
|
|
501
554
|
await wasmWebClient.createMockClient(seed, undefined, undefined);
|
|
502
555
|
|
|
@@ -23347,6 +23400,12 @@ class WebClient {
|
|
|
23347
23400
|
/**
|
|
23348
23401
|
* Generates a transaction proof using either the provided prover or the client's default
|
|
23349
23402
|
* prover if none is supplied.
|
|
23403
|
+
*
|
|
23404
|
+
* With an explicit prover this is a pure computation over the `TransactionResult` and does
|
|
23405
|
+
* not touch client state, so it works on a bare `WebClient` that never ran
|
|
23406
|
+
* `createClient()`. "Prover-only" hosts rely on this — e.g. a `chrome.offscreen` document
|
|
23407
|
+
* that proves on its own rayon thread pool. Only the default-prover fallback requires an
|
|
23408
|
+
* initialized client.
|
|
23350
23409
|
* @param {TransactionResult} transaction_result
|
|
23351
23410
|
* @param {TransactionProver | null} [prover]
|
|
23352
23411
|
* @returns {Promise<ProvenTransaction>}
|
|
@@ -23511,7 +23570,23 @@ class WebClient {
|
|
|
23511
23570
|
return ret;
|
|
23512
23571
|
}
|
|
23513
23572
|
/**
|
|
23514
|
-
* Internal implementation of `
|
|
23573
|
+
* Internal implementation of `sync_chain` (on-chain-only sync). Use `syncChain()` from JS.
|
|
23574
|
+
* @returns {Promise<SyncSummary>}
|
|
23575
|
+
*/
|
|
23576
|
+
syncChainImpl() {
|
|
23577
|
+
const ret = wasm.webclient_syncChainImpl(this.__wbg_ptr);
|
|
23578
|
+
return ret;
|
|
23579
|
+
}
|
|
23580
|
+
/**
|
|
23581
|
+
* Internal implementation of `sync_note_transport`. Use `syncNoteTransport()` from JS.
|
|
23582
|
+
* @returns {Promise<void>}
|
|
23583
|
+
*/
|
|
23584
|
+
syncNoteTransportImpl() {
|
|
23585
|
+
const ret = wasm.webclient_syncNoteTransportImpl(this.__wbg_ptr);
|
|
23586
|
+
return ret;
|
|
23587
|
+
}
|
|
23588
|
+
/**
|
|
23589
|
+
* Internal implementation of `sync_state` (combined NTL + chain sync).
|
|
23515
23590
|
*
|
|
23516
23591
|
* This method performs the actual sync operation. Concurrent call coordination
|
|
23517
23592
|
* is handled at the JavaScript layer using the Web Locks API.
|
|
@@ -23798,6 +23873,38 @@ function initThreadPool(num_threads) {
|
|
|
23798
23873
|
return ret;
|
|
23799
23874
|
}
|
|
23800
23875
|
|
|
23876
|
+
/**
|
|
23877
|
+
* Same probe, but exported as an async fn so it runs inside a
|
|
23878
|
+
* wasm-bindgen-futures task — mirroring the context `proveTransaction`
|
|
23879
|
+
* executes in. Divergence between the two reveals whether the futures
|
|
23880
|
+
* context breaks rayon dispatch.
|
|
23881
|
+
* @returns {Promise<string>}
|
|
23882
|
+
*/
|
|
23883
|
+
function mtProbeAsync() {
|
|
23884
|
+
const ret = wasm.mtProbeAsync();
|
|
23885
|
+
return ret;
|
|
23886
|
+
}
|
|
23887
|
+
|
|
23888
|
+
/**
|
|
23889
|
+
* MT diagnostics: report which rayon threads execute a tiny par_iter when
|
|
23890
|
+
* dispatched from a plain synchronous wasm export. `outer` is the calling
|
|
23891
|
+
* thread's pool index (-1 = external), `inside` the distinct pool indexes
|
|
23892
|
+
* that ran chunks.
|
|
23893
|
+
* @returns {string}
|
|
23894
|
+
*/
|
|
23895
|
+
function mtProbeSync() {
|
|
23896
|
+
let deferred1_0;
|
|
23897
|
+
let deferred1_1;
|
|
23898
|
+
try {
|
|
23899
|
+
const ret = wasm.mtProbeSync();
|
|
23900
|
+
deferred1_0 = ret[0];
|
|
23901
|
+
deferred1_1 = ret[1];
|
|
23902
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
23903
|
+
} finally {
|
|
23904
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
23905
|
+
}
|
|
23906
|
+
}
|
|
23907
|
+
|
|
23801
23908
|
/**
|
|
23802
23909
|
* Synthetic parallel benchmark: sums 0..n via `par_iter()` on the global
|
|
23803
23910
|
* rayon pool. Returns elapsed micros. If the pool is actually multi-threaded,
|
|
@@ -25602,17 +25709,17 @@ function __wbg_get_imports(memory) {
|
|
|
25602
25709
|
return ret;
|
|
25603
25710
|
},
|
|
25604
25711
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
25605
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
25712
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 125, function: Function { arguments: [Externref], shim_idx: 126, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
25606
25713
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_9615981aab4586b0___closure__destroy___dyn_core_91ed24bc3d45dfd0___ops__function__FnMut__wasm_bindgen_9615981aab4586b0___JsValue____Output_______, wasm_bindgen_9615981aab4586b0___convert__closures_____invoke___wasm_bindgen_9615981aab4586b0___JsValue_____);
|
|
25607
25714
|
return ret;
|
|
25608
25715
|
},
|
|
25609
25716
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
25610
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
25717
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 125, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 126, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
25611
25718
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_9615981aab4586b0___closure__destroy___dyn_core_91ed24bc3d45dfd0___ops__function__FnMut__wasm_bindgen_9615981aab4586b0___JsValue____Output_______, wasm_bindgen_9615981aab4586b0___convert__closures_____invoke___wasm_bindgen_9615981aab4586b0___JsValue_____);
|
|
25612
25719
|
return ret;
|
|
25613
25720
|
},
|
|
25614
25721
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
25615
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
25722
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 125, function: Function { arguments: [], shim_idx: 448, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
25616
25723
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_9615981aab4586b0___closure__destroy___dyn_core_91ed24bc3d45dfd0___ops__function__FnMut__wasm_bindgen_9615981aab4586b0___JsValue____Output_______, wasm_bindgen_9615981aab4586b0___convert__closures_____invoke______);
|
|
25617
25724
|
return ret;
|
|
25618
25725
|
},
|
|
@@ -26709,6 +26816,8 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
26709
26816
|
importStore: importStore,
|
|
26710
26817
|
initSync: initSync,
|
|
26711
26818
|
initThreadPool: initThreadPool,
|
|
26819
|
+
mtProbeAsync: mtProbeAsync,
|
|
26820
|
+
mtProbeSync: mtProbeSync,
|
|
26712
26821
|
parallelSumBench: parallelSumBench,
|
|
26713
26822
|
rayonThreadCount: rayonThreadCount,
|
|
26714
26823
|
sequentialSumBench: sequentialSumBench,
|
|
@@ -26719,7 +26828,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
26719
26828
|
|
|
26720
26829
|
const module$1 = new URL("assets/miden_client_web.wasm", self.location.href);
|
|
26721
26830
|
|
|
26722
|
-
var
|
|
26831
|
+
var CargoC9UbiAcT = /*#__PURE__*/Object.freeze({
|
|
26723
26832
|
__proto__: null,
|
|
26724
26833
|
Account: Account,
|
|
26725
26834
|
AccountArray: AccountArray,
|
|
@@ -26873,6 +26982,8 @@ var CargoSmJQCGjz = /*#__PURE__*/Object.freeze({
|
|
|
26873
26982
|
importStore: importStore,
|
|
26874
26983
|
initSync: initSync,
|
|
26875
26984
|
initThreadPool: initThreadPool,
|
|
26985
|
+
mtProbeAsync: mtProbeAsync,
|
|
26986
|
+
mtProbeSync: mtProbeSync,
|
|
26876
26987
|
parallelSumBench: parallelSumBench,
|
|
26877
26988
|
rayonThreadCount: rayonThreadCount,
|
|
26878
26989
|
sequentialSumBench: sequentialSumBench,
|