@miden-sdk/miden-sdk 0.15.7 → 0.16.0-alpha.1
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 +0 -152
- package/dist/mt/{Cargo-CnGom-_z.js → Cargo-DKsyWYgG.js} +700 -1245
- package/dist/mt/Cargo-DKsyWYgG.js.map +1 -0
- package/dist/mt/api-types.d.ts +38 -370
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +179 -402
- package/dist/mt/docs-entry.d.ts +3 -9
- package/dist/mt/eager.js +1 -1
- package/dist/mt/index.d.ts +0 -3
- package/dist/mt/index.js +53 -701
- 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-CnGom-_z-X_3VwTbo.js → Cargo-DKsyWYgG-DfOhgt23.js} +700 -1245
- package/dist/mt/workers/Cargo-DKsyWYgG-DfOhgt23.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +703 -1251
- 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-DR9fiMbE.js → Cargo-LwITdlzJ.js} +695 -1237
- package/dist/st/Cargo-LwITdlzJ.js.map +1 -0
- package/dist/st/api-types.d.ts +38 -370
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +179 -402
- package/dist/st/docs-entry.d.ts +3 -9
- package/dist/st/eager.js +1 -1
- package/dist/st/index.d.ts +0 -3
- package/dist/st/index.js +53 -701
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-DR9fiMbE-C0G0clA_.js → Cargo-LwITdlzJ-Dyl2bCwN.js} +695 -1237
- package/dist/st/workers/Cargo-LwITdlzJ-Dyl2bCwN.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +698 -1243
- 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/client.js +2 -4
- package/js/node/client-factory.js +4 -11
- package/js/node/napi-compat.js +1 -0
- package/js/node-index.js +11 -11
- package/js/resources/compiler.js +23 -12
- package/js/resources/transactions.js +24 -540
- package/js/standalone.js +3 -61
- package/package.json +4 -4
- package/dist/mt/Cargo-CnGom-_z.js.map +0 -1
- package/dist/mt/workers/Cargo-CnGom-_z-X_3VwTbo.js.map +0 -1
- package/dist/st/Cargo-DR9fiMbE.js.map +0 -1
- package/dist/st/workers/Cargo-DR9fiMbE-C0G0clA_.js.map +0 -1
- package/js/resources/pswap.js +0 -132
package/dist/mt/api-types.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ import type {
|
|
|
14
14
|
TransactionId,
|
|
15
15
|
TransactionRequest,
|
|
16
16
|
TransactionResult,
|
|
17
|
-
TransactionStoreUpdate,
|
|
18
|
-
ProvenTransaction,
|
|
19
17
|
TransactionSummary,
|
|
20
18
|
TransactionRecord,
|
|
21
19
|
InputNoteRecord,
|
|
@@ -28,16 +26,13 @@ import type {
|
|
|
28
26
|
NoteExportFormat,
|
|
29
27
|
StorageSlot,
|
|
30
28
|
AccountComponent,
|
|
29
|
+
Library,
|
|
31
30
|
AuthSecretKey,
|
|
32
31
|
AccountStorageRequirements,
|
|
33
32
|
TransactionScript,
|
|
34
33
|
NoteScript,
|
|
35
|
-
NoteRecipient,
|
|
36
|
-
NoteExecutionHint,
|
|
37
|
-
NetworkAccountTarget,
|
|
38
34
|
AdviceInputs,
|
|
39
35
|
FeltArray,
|
|
40
|
-
PswapLineageRecord,
|
|
41
36
|
} from "./crates/miden_client_web.js";
|
|
42
37
|
|
|
43
38
|
// Import the full namespace for the MidenArrayConstructors type
|
|
@@ -192,8 +187,6 @@ export interface ClientOptions {
|
|
|
192
187
|
storeName?: string;
|
|
193
188
|
/** Sync state on creation (default: false). */
|
|
194
189
|
autoSync?: boolean;
|
|
195
|
-
/** Enable debug mode for transaction execution (default: false). */
|
|
196
|
-
debugMode?: boolean;
|
|
197
190
|
/** External keystore callbacks. */
|
|
198
191
|
keystore?: {
|
|
199
192
|
getKey: GetKeyCallback;
|
|
@@ -362,48 +355,6 @@ export interface SendResult {
|
|
|
362
355
|
result: TransactionResult;
|
|
363
356
|
}
|
|
364
357
|
|
|
365
|
-
/**
|
|
366
|
-
* Options for {@link TransactionsResource.createNetworkNote} and the standalone
|
|
367
|
-
* {@link buildNetworkNote}. Builds a Public, custom-script note carrying a
|
|
368
|
-
* `NetworkAccountTarget` attachment so a public network account auto-consumes it.
|
|
369
|
-
*
|
|
370
|
-
* Provide exactly one of `recipient` or `script`.
|
|
371
|
-
*/
|
|
372
|
-
export interface NetworkNoteOptions extends TransactionOptions {
|
|
373
|
-
/** Account that creates, funds, and submits the note (the executing sender). */
|
|
374
|
-
account: AccountRef;
|
|
375
|
-
/**
|
|
376
|
-
* The network account the note targets. Any account reference, or a pre-built
|
|
377
|
-
* `NetworkAccountTarget`. Encoded as the note's `NetworkAccountTarget`
|
|
378
|
-
* attachment — this is what makes `isNetworkNote()` true.
|
|
379
|
-
*/
|
|
380
|
-
target: AccountRef | NetworkAccountTarget;
|
|
381
|
-
/** Execution hint when `target` is an account reference. Defaults to `always`. */
|
|
382
|
-
executionHint?: NoteExecutionHint;
|
|
383
|
-
/**
|
|
384
|
-
* Recipient carrying the note's custom consumption script. Build with
|
|
385
|
-
* `new NoteRecipient(serialNum, noteScript, noteStorage)`, or omit and pass
|
|
386
|
-
* `script` to have the recipient built for you.
|
|
387
|
-
*/
|
|
388
|
-
recipient?: NoteRecipient;
|
|
389
|
-
/** Custom consumption script; the recipient is built with a fresh serial number. */
|
|
390
|
-
script?: NoteScript;
|
|
391
|
-
/** Note storage / inputs the script reads (used with `script`). */
|
|
392
|
-
inputs?: bigint[];
|
|
393
|
-
/** Assets locked into the note. Optional — a note may carry no assets. */
|
|
394
|
-
assets?: Asset | Asset[];
|
|
395
|
-
/** Extra attachment payload appended AFTER the required `NetworkAccountTarget`. */
|
|
396
|
-
attachment?: bigint[];
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/** Result of {@link TransactionsResource.createNetworkNote}. */
|
|
400
|
-
export interface NetworkNoteResult {
|
|
401
|
-
txId: TransactionId;
|
|
402
|
-
/** The built network note (read its id / attachments). */
|
|
403
|
-
note: Note;
|
|
404
|
-
result: TransactionResult;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
358
|
/** Result of methods that previously returned bare TransactionId. */
|
|
408
359
|
export interface TransactionSubmitResult {
|
|
409
360
|
txId: TransactionId;
|
|
@@ -421,21 +372,6 @@ export interface MintOptions extends TransactionOptions {
|
|
|
421
372
|
type?: NoteVisibility;
|
|
422
373
|
}
|
|
423
374
|
|
|
424
|
-
export interface BridgeOptions extends TransactionOptions {
|
|
425
|
-
/** Account that creates and funds the bridge note (the sender / executing account). */
|
|
426
|
-
account: AccountRef;
|
|
427
|
-
/** Bridge account that consumes the note and burns the bridged asset. */
|
|
428
|
-
bridgeAccount: AccountRef;
|
|
429
|
-
/** Faucet / token ID of the fungible asset to bridge. */
|
|
430
|
-
token: AccountRef;
|
|
431
|
-
/** Amount of the asset to bridge. */
|
|
432
|
-
amount: number | bigint;
|
|
433
|
-
/** AggLayer-assigned network ID of the destination chain. */
|
|
434
|
-
destinationNetwork: number;
|
|
435
|
-
/** Destination Ethereum address on the destination network (0x-prefixed hex). */
|
|
436
|
-
destinationAddress: string;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
375
|
export interface ConsumeOptions extends TransactionOptions {
|
|
440
376
|
account: AccountRef;
|
|
441
377
|
notes: NoteInput | NoteInput[];
|
|
@@ -446,148 +382,6 @@ export interface ConsumeAllOptions extends TransactionOptions {
|
|
|
446
382
|
maxNotes?: number;
|
|
447
383
|
}
|
|
448
384
|
|
|
449
|
-
/**
|
|
450
|
-
* A single operation inside a transaction batch. The shape mirrors the
|
|
451
|
-
* singular options types (`SendOptions`, `MintOptions`, ...) minus the
|
|
452
|
-
* `account` field — the executing account is set once at the batch level
|
|
453
|
-
* and shared by every operation (V1 single-account constraint).
|
|
454
|
-
*/
|
|
455
|
-
export type BatchOperation =
|
|
456
|
-
| {
|
|
457
|
-
kind: "send";
|
|
458
|
-
to: AccountRef;
|
|
459
|
-
token: AccountRef;
|
|
460
|
-
amount: number | bigint;
|
|
461
|
-
type?: NoteVisibility;
|
|
462
|
-
reclaimAfter?: number;
|
|
463
|
-
timelockUntil?: number;
|
|
464
|
-
}
|
|
465
|
-
| {
|
|
466
|
-
kind: "mint";
|
|
467
|
-
to: AccountRef;
|
|
468
|
-
amount: number | bigint;
|
|
469
|
-
type?: NoteVisibility;
|
|
470
|
-
}
|
|
471
|
-
| {
|
|
472
|
-
kind: "consume";
|
|
473
|
-
notes: NoteInput | NoteInput[];
|
|
474
|
-
}
|
|
475
|
-
| {
|
|
476
|
-
kind: "swap";
|
|
477
|
-
offer: Asset;
|
|
478
|
-
request: Asset;
|
|
479
|
-
type?: NoteVisibility;
|
|
480
|
-
paybackType?: NoteVisibility;
|
|
481
|
-
}
|
|
482
|
-
| {
|
|
483
|
-
kind: "execute";
|
|
484
|
-
script: TransactionScript;
|
|
485
|
-
foreignAccounts?: (
|
|
486
|
-
| AccountRef
|
|
487
|
-
| { id: AccountRef; storage?: AccountStorageRequirements }
|
|
488
|
-
)[];
|
|
489
|
-
}
|
|
490
|
-
| {
|
|
491
|
-
/** Escape hatch for pre-built TransactionRequests. */
|
|
492
|
-
kind: "custom";
|
|
493
|
-
request: TransactionRequest;
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
export interface BatchOptions {
|
|
497
|
-
/** The account executing every operation in the batch (single-account in V1). */
|
|
498
|
-
account: AccountRef;
|
|
499
|
-
/** Operations to execute atomically as a batch. Must be non-empty. */
|
|
500
|
-
operations: BatchOperation[];
|
|
501
|
-
/**
|
|
502
|
-
* Wait until the batch's block has been observed in the local sync height.
|
|
503
|
-
* Differs from singular `waitForConfirmation`: the V1 batch API returns
|
|
504
|
-
* only a block number, so we poll chain height rather than per-tx status.
|
|
505
|
-
*/
|
|
506
|
-
waitForConfirmation?: boolean;
|
|
507
|
-
/** Wall-clock polling timeout for `waitForConfirmation` (default 60_000ms). */
|
|
508
|
-
timeout?: number;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
export interface BatchSubmitResult {
|
|
512
|
-
/** The block number the batch was accepted into. */
|
|
513
|
-
blockNumber: number;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/** Options for {@link TransactionExecution.prove}. */
|
|
517
|
-
export interface ProveOptions {
|
|
518
|
-
/**
|
|
519
|
-
* Per-call prover override. Falls back to the client's default prover, or
|
|
520
|
-
* the built-in local prover if none is configured.
|
|
521
|
-
*
|
|
522
|
-
* A prover is consumed by the call — build (or clone) a fresh one per
|
|
523
|
-
* `prove()`. Reusing an already-passed prover silently falls back to the
|
|
524
|
-
* built-in local prover.
|
|
525
|
-
*/
|
|
526
|
-
prover?: TransactionProver;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* A locally-executed transaction — nothing proven, submitted, or persisted yet.
|
|
531
|
-
* First stage of the manual transaction lifecycle, returned by
|
|
532
|
-
* {@link TransactionsResource.executeRequest}. Advance it with {@link prove}.
|
|
533
|
-
*/
|
|
534
|
-
export interface TransactionExecution {
|
|
535
|
-
/** The raw execution artifact (account delta, output notes, …). */
|
|
536
|
-
readonly result: TransactionResult;
|
|
537
|
-
/** The executed transaction's id. */
|
|
538
|
-
readonly id: TransactionId;
|
|
539
|
-
/**
|
|
540
|
-
* Prove this execution, then continue with {@link TransactionProof.submit}.
|
|
541
|
-
* Pure computation — touches neither the network nor the local store.
|
|
542
|
-
*
|
|
543
|
-
* @param options - Optional per-call prover override.
|
|
544
|
-
*/
|
|
545
|
-
prove(options?: ProveOptions): Promise<TransactionProof>;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* A proven transaction, ready for the network. Second stage of the manual
|
|
550
|
-
* transaction lifecycle, returned by {@link TransactionExecution.prove}.
|
|
551
|
-
* Advance it with {@link submit}.
|
|
552
|
-
*/
|
|
553
|
-
export interface TransactionProof {
|
|
554
|
-
/** The raw proof — e.g. to serialize and submit from a different client. */
|
|
555
|
-
readonly proof: ProvenTransaction;
|
|
556
|
-
/** The execution result this proof was produced from. */
|
|
557
|
-
readonly result: TransactionResult;
|
|
558
|
-
/**
|
|
559
|
-
* Submit the proof to the network, then persist with
|
|
560
|
-
* {@link TransactionSubmission.apply}. Does NOT persist locally on its own.
|
|
561
|
-
*/
|
|
562
|
-
submit(): Promise<TransactionSubmission>;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* A submitted transaction. Final stage of the manual transaction lifecycle,
|
|
567
|
-
* returned by {@link TransactionProof.submit}. Persist it with {@link apply},
|
|
568
|
-
* or block until it commits with {@link waitForConfirmation}.
|
|
569
|
-
*/
|
|
570
|
-
export interface TransactionSubmission {
|
|
571
|
-
/** The block height the transaction was submitted at. */
|
|
572
|
-
readonly blockNumber: number;
|
|
573
|
-
/** The execution result that was submitted. */
|
|
574
|
-
readonly result: TransactionResult;
|
|
575
|
-
/**
|
|
576
|
-
* Persist the transaction into the local store, firing registered
|
|
577
|
-
* transaction observers (e.g. PSWAP lineage tracking). Until this runs the
|
|
578
|
-
* local store is unaware of the transaction.
|
|
579
|
-
*
|
|
580
|
-
* @returns The pre-apply store update.
|
|
581
|
-
*/
|
|
582
|
-
apply(): Promise<TransactionStoreUpdate>;
|
|
583
|
-
/**
|
|
584
|
-
* Poll local sync height until the transaction commits on-chain.
|
|
585
|
-
*
|
|
586
|
-
* @param options - Polling options (timeout, interval, onProgress).
|
|
587
|
-
*/
|
|
588
|
-
waitForConfirmation(options?: WaitOptions): Promise<void>;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
385
|
export interface SwapOptions extends TransactionOptions {
|
|
592
386
|
account: AccountRef;
|
|
593
387
|
offer: Asset;
|
|
@@ -631,18 +425,6 @@ export interface PswapCancelOptions extends TransactionOptions {
|
|
|
631
425
|
note: NoteInput;
|
|
632
426
|
}
|
|
633
427
|
|
|
634
|
-
export interface PswapCancelByOrderOptions extends TransactionOptions {
|
|
635
|
-
/**
|
|
636
|
-
* Stable order id of the lineage to cancel, as reported by
|
|
637
|
-
* {@link PswapLineageRecord.orderId}. Accepts the decimal string or a
|
|
638
|
-
* `bigint`. `number` is rejected: a PSWAP order id is `u64`-shaped and
|
|
639
|
-
* routinely exceeds `Number.MAX_SAFE_INTEGER`, which a JS `number` cannot
|
|
640
|
-
* represent without silent precision loss. The creator account and current
|
|
641
|
-
* tip note are resolved from the tracked lineage.
|
|
642
|
-
*/
|
|
643
|
-
orderId: string | bigint;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
428
|
export interface ExecuteOptions extends TransactionOptions {
|
|
647
429
|
/** Account executing the custom script. */
|
|
648
430
|
account: AccountRef;
|
|
@@ -688,16 +470,6 @@ export interface PreviewMintOptions {
|
|
|
688
470
|
type?: NoteVisibility;
|
|
689
471
|
}
|
|
690
472
|
|
|
691
|
-
export interface PreviewBridgeOptions {
|
|
692
|
-
operation: "bridge";
|
|
693
|
-
account: AccountRef;
|
|
694
|
-
bridgeAccount: AccountRef;
|
|
695
|
-
token: AccountRef;
|
|
696
|
-
amount: number | bigint;
|
|
697
|
-
destinationNetwork: number;
|
|
698
|
-
destinationAddress: string;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
473
|
export interface PreviewConsumeOptions {
|
|
702
474
|
operation: "consume";
|
|
703
475
|
account: AccountRef;
|
|
@@ -745,7 +517,6 @@ export interface PreviewCustomOptions {
|
|
|
745
517
|
export type PreviewOptions =
|
|
746
518
|
| PreviewSendOptions
|
|
747
519
|
| PreviewMintOptions
|
|
748
|
-
| PreviewBridgeOptions
|
|
749
520
|
| PreviewConsumeOptions
|
|
750
521
|
| PreviewSwapOptions
|
|
751
522
|
| PreviewPswapCreateOptions
|
|
@@ -801,7 +572,7 @@ export type NoteQuery =
|
|
|
801
572
|
export interface NoteOptions {
|
|
802
573
|
from: AccountRef;
|
|
803
574
|
to: AccountRef;
|
|
804
|
-
assets: Asset | Asset[];
|
|
575
|
+
assets: Asset | [Asset, ...Asset[]];
|
|
805
576
|
type?: NoteVisibility;
|
|
806
577
|
attachment?: Felt[];
|
|
807
578
|
}
|
|
@@ -945,22 +716,6 @@ export interface TransactionsResource {
|
|
|
945
716
|
* @param options - Mint options including the faucet, recipient, and amount.
|
|
946
717
|
*/
|
|
947
718
|
mint(options: MintOptions): Promise<TransactionSubmitResult>;
|
|
948
|
-
/**
|
|
949
|
-
* Builds a Public custom-script note carrying a `NetworkAccountTarget`
|
|
950
|
-
* attachment, submits it as an own output note, and (optionally) waits for
|
|
951
|
-
* confirmation. The submitted note satisfies `Note.isNetworkNote()`, so a
|
|
952
|
-
* public network account will auto-consume it.
|
|
953
|
-
*/
|
|
954
|
-
createNetworkNote(options: NetworkNoteOptions): Promise<NetworkNoteResult>;
|
|
955
|
-
/**
|
|
956
|
-
* Bridge a fungible asset out to another network via the AggLayer. Emits a
|
|
957
|
-
* single public B2AGG (Bridge-to-AggLayer) note that the bridge account
|
|
958
|
-
* consumes, burning the asset so it can be claimed at the destination
|
|
959
|
-
* Ethereum address on the destination network.
|
|
960
|
-
*
|
|
961
|
-
* @param options - Sender, bridge account, token, amount, and destination.
|
|
962
|
-
*/
|
|
963
|
-
bridge(options: BridgeOptions): Promise<TransactionSubmitResult>;
|
|
964
719
|
/**
|
|
965
720
|
* Consume one or more notes for an account.
|
|
966
721
|
*
|
|
@@ -1013,8 +768,18 @@ export interface TransactionsResource {
|
|
|
1013
768
|
execute(options: ExecuteOptions): Promise<TransactionSubmitResult>;
|
|
1014
769
|
|
|
1015
770
|
/**
|
|
1016
|
-
* Dry-run a transaction to
|
|
1017
|
-
* the
|
|
771
|
+
* Dry-run a transaction to obtain the {@link TransactionSummary} the
|
|
772
|
+
* account is being asked to authorize, without submitting anything to the
|
|
773
|
+
* network.
|
|
774
|
+
*
|
|
775
|
+
* The summary only exists while authorization is pending: it is returned
|
|
776
|
+
* when the account's auth procedure aborts with the unauthorized event
|
|
777
|
+
* (e.g. a multisig below its signing threshold), so it can be signed
|
|
778
|
+
* out-of-band. If the transaction is already fully authorized, execution
|
|
779
|
+
* succeeds without producing a summary and this method rejects with an
|
|
780
|
+
* error whose `code` is `"TRANSACTION_ALREADY_AUTHORIZED"` (on Node.js the
|
|
781
|
+
* code prefixes the error message instead) — submit the transaction with
|
|
782
|
+
* `execute` instead.
|
|
1018
783
|
*
|
|
1019
784
|
* @param options - Preview options discriminated by `operation` field.
|
|
1020
785
|
*/
|
|
@@ -1034,77 +799,6 @@ export interface TransactionsResource {
|
|
|
1034
799
|
options?: TransactionOptions
|
|
1035
800
|
): Promise<TransactionSubmitResult>;
|
|
1036
801
|
|
|
1037
|
-
/**
|
|
1038
|
-
* Execute a transaction request locally — nothing is proven, submitted, or
|
|
1039
|
-
* persisted. Returns a {@link TransactionExecution} handle; advance the
|
|
1040
|
-
* lifecycle by chaining `.prove()` → `.submit()` → `.apply()`, benchmarking
|
|
1041
|
-
* or error-handling each stage independently:
|
|
1042
|
-
*
|
|
1043
|
-
* ```ts
|
|
1044
|
-
* const executed = await client.transactions.executeRequest(account, request);
|
|
1045
|
-
* const proven = await executed.prove({ prover });
|
|
1046
|
-
* const submitted = await proven.submit();
|
|
1047
|
-
* await submitted.apply();
|
|
1048
|
-
* ```
|
|
1049
|
-
*
|
|
1050
|
-
* {@link submit} runs every stage in one call. The stages are not atomic as a
|
|
1051
|
-
* group: awaiting other mutating calls on the same account between them can
|
|
1052
|
-
* interleave state — drive the chain as an uninterrupted sequence per account.
|
|
1053
|
-
*
|
|
1054
|
-
* @param account - The account executing the transaction.
|
|
1055
|
-
* @param request - The pre-built transaction request.
|
|
1056
|
-
* @returns A handle to the executed transaction, ready to prove.
|
|
1057
|
-
*/
|
|
1058
|
-
executeRequest(
|
|
1059
|
-
account: AccountRef,
|
|
1060
|
-
request: TransactionRequest
|
|
1061
|
-
): Promise<TransactionExecution>;
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
* Submit a proof produced somewhere that shares nothing with this client —
|
|
1065
|
-
* e.g. a detached prover that never saw the local store. Returns a
|
|
1066
|
-
* {@link TransactionSubmission} handle; call `.apply()` on it to persist
|
|
1067
|
-
* locally. For the in-process flow prefer
|
|
1068
|
-
* `executeRequest(...)` → `.prove()` → `.submit()`, which threads the proof
|
|
1069
|
-
* and result for you.
|
|
1070
|
-
*
|
|
1071
|
-
* @param proof - A proof for `result`, proven elsewhere.
|
|
1072
|
-
* @param result - The matching execution result.
|
|
1073
|
-
* @returns A handle to the submitted transaction, ready to apply.
|
|
1074
|
-
*/
|
|
1075
|
-
submitProven(
|
|
1076
|
-
proof: ProvenTransaction,
|
|
1077
|
-
result: TransactionResult
|
|
1078
|
-
): Promise<TransactionSubmission>;
|
|
1079
|
-
|
|
1080
|
-
/**
|
|
1081
|
-
* Execute a heterogeneous batch of operations against a single account.
|
|
1082
|
-
* Each operation is built, proven individually and as a batch, and all
|
|
1083
|
-
* operations are submitted atomically — either every tx in the batch
|
|
1084
|
-
* lands or none does.
|
|
1085
|
-
*
|
|
1086
|
-
* V1 supports only same-account batches (mirrors the underlying Rust
|
|
1087
|
-
* `Client::new_transaction_batch()` constraint).
|
|
1088
|
-
*
|
|
1089
|
-
* @param options - Batch options including the account and operations.
|
|
1090
|
-
*/
|
|
1091
|
-
batch(options: BatchOptions): Promise<BatchSubmitResult>;
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
* Submit pre-built TransactionRequests as an atomic batch. Plural
|
|
1095
|
-
* counterpart of {@link submit} — for callers that already have built
|
|
1096
|
-
* requests in hand and want to skip the high-level operation builders.
|
|
1097
|
-
*
|
|
1098
|
-
* @param account - The account executing every transaction in the batch.
|
|
1099
|
-
* @param requests - Pre-built transaction requests (must be non-empty).
|
|
1100
|
-
* @param options - Optional batch settings (waitForConfirmation, timeout, prover).
|
|
1101
|
-
*/
|
|
1102
|
-
submitBatch(
|
|
1103
|
-
account: AccountRef,
|
|
1104
|
-
requests: TransactionRequest[],
|
|
1105
|
-
options?: Omit<BatchOptions, "account" | "operations">
|
|
1106
|
-
): Promise<BatchSubmitResult>;
|
|
1107
|
-
|
|
1108
802
|
/** Execute a program (view call) and return the resulting stack output. */
|
|
1109
803
|
executeProgram(options: ExecuteProgramOptions): Promise<FeltArray>;
|
|
1110
804
|
|
|
@@ -1125,46 +819,6 @@ export interface TransactionsResource {
|
|
|
1125
819
|
waitFor(txId: string | TransactionId, options?: WaitOptions): Promise<void>;
|
|
1126
820
|
}
|
|
1127
821
|
|
|
1128
|
-
export interface PswapResource {
|
|
1129
|
-
/**
|
|
1130
|
-
* Returns every partial-swap (PSWAP) lineage tracked by this client. A
|
|
1131
|
-
* lineage records how a PSWAP note has been filled round by round, from the
|
|
1132
|
-
* original note through each remainder to the current tip.
|
|
1133
|
-
*/
|
|
1134
|
-
lineages(): Promise<PswapLineageRecord[]>;
|
|
1135
|
-
/**
|
|
1136
|
-
* Returns the PSWAP lineages created by a specific local account.
|
|
1137
|
-
*
|
|
1138
|
-
* @param account - Creator account (hex, bech32, `Account`, or `AccountId`).
|
|
1139
|
-
*/
|
|
1140
|
-
lineagesFor(account: AccountRef): Promise<PswapLineageRecord[]>;
|
|
1141
|
-
/**
|
|
1142
|
-
* Returns the lineage for a single order, or `null` if this client is not
|
|
1143
|
-
* tracking it — either because the order was not created by this client, or
|
|
1144
|
-
* because tracking did not register when it was created. Registration runs as
|
|
1145
|
-
* a transaction observer at create time and does not block the create
|
|
1146
|
-
* transaction if it fails.
|
|
1147
|
-
*
|
|
1148
|
-
* @param orderId - Stable order id (decimal string or bigint). `number` is
|
|
1149
|
-
* rejected: a PSWAP order id is `u64`-shaped and routinely exceeds
|
|
1150
|
-
* `Number.MAX_SAFE_INTEGER`, which a JS `number` cannot represent without
|
|
1151
|
-
* silent precision loss.
|
|
1152
|
-
*/
|
|
1153
|
-
lineage(orderId: string | bigint): Promise<PswapLineageRecord | null>;
|
|
1154
|
-
/**
|
|
1155
|
-
* Reclaim the unfilled offered asset on the current tip of an active
|
|
1156
|
-
* lineage, identified by its stable order id. Builds the cancel transaction,
|
|
1157
|
-
* resolves the creator account from the tracked lineage, and submits it
|
|
1158
|
-
* through the same prove/submit path as the other transaction helpers.
|
|
1159
|
-
* Throws if no lineage is tracked for the order.
|
|
1160
|
-
*
|
|
1161
|
-
* @param options - Order id and optional transaction options.
|
|
1162
|
-
*/
|
|
1163
|
-
cancelByOrder(
|
|
1164
|
-
options: PswapCancelByOrderOptions
|
|
1165
|
-
): Promise<TransactionSubmitResult>;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
822
|
export interface NotesResource {
|
|
1169
823
|
/**
|
|
1170
824
|
* List received (input) notes, optionally filtered by status or IDs.
|
|
@@ -1233,6 +887,11 @@ export interface NotesResource {
|
|
|
1233
887
|
export interface CompileComponentOptions {
|
|
1234
888
|
/** MASM source code for the component. */
|
|
1235
889
|
code: string;
|
|
890
|
+
/**
|
|
891
|
+
* Module path used to derive procedure identities. Use the same namespace when
|
|
892
|
+
* linking this component into transaction scripts.
|
|
893
|
+
*/
|
|
894
|
+
namespace?: string;
|
|
1236
895
|
/** Initial storage slots for the component. */
|
|
1237
896
|
slots?: StorageSlot[];
|
|
1238
897
|
/**
|
|
@@ -1259,18 +918,35 @@ export interface CompileTxScriptLibrary {
|
|
|
1259
918
|
linking?: Linking;
|
|
1260
919
|
}
|
|
1261
920
|
|
|
921
|
+
/** Links the exact compiled code installed by an account component. */
|
|
922
|
+
export interface CompileAccountComponentLibrary {
|
|
923
|
+
/** Account component whose installed code should be linked. */
|
|
924
|
+
component: AccountComponent;
|
|
925
|
+
/**
|
|
926
|
+
* `Linking.Dynamic` (default) — procedures are linked via DYNCALL at runtime.
|
|
927
|
+
* `Linking.Static` — procedures are inlined at compile time.
|
|
928
|
+
*/
|
|
929
|
+
linking?: Linking;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/** A script library supplied inline, pre-built, or from an installed account component. */
|
|
933
|
+
export type CompileScriptLibrary =
|
|
934
|
+
| CompileTxScriptLibrary
|
|
935
|
+
| CompileAccountComponentLibrary
|
|
936
|
+
| Library;
|
|
937
|
+
|
|
1262
938
|
export interface CompileTxScriptOptions {
|
|
1263
939
|
/** MASM source code for the transaction script. */
|
|
1264
940
|
code: string;
|
|
1265
941
|
/** Component libraries to link. */
|
|
1266
|
-
libraries?:
|
|
942
|
+
libraries?: CompileScriptLibrary[];
|
|
1267
943
|
}
|
|
1268
944
|
|
|
1269
945
|
export interface CompileNoteScriptOptions {
|
|
1270
946
|
/** MASM source code for the note script. */
|
|
1271
947
|
code: string;
|
|
1272
948
|
/** Component libraries to link. */
|
|
1273
|
-
libraries?:
|
|
949
|
+
libraries?: CompileScriptLibrary[];
|
|
1274
950
|
}
|
|
1275
951
|
|
|
1276
952
|
export declare class CompilerResource {
|
|
@@ -1401,7 +1077,6 @@ export declare class MidenClient {
|
|
|
1401
1077
|
readonly settings: SettingsResource;
|
|
1402
1078
|
readonly compile: CompilerResource;
|
|
1403
1079
|
readonly keystore: KeystoreResource;
|
|
1404
|
-
readonly pswap: PswapResource;
|
|
1405
1080
|
|
|
1406
1081
|
/** Syncs the client: fetches private notes from the Note Transport Layer, then syncs on-chain state. Fails fast on either. */
|
|
1407
1082
|
sync(): Promise<SyncSummary>;
|
|
@@ -1475,13 +1150,6 @@ export declare function createP2IDENote(
|
|
|
1475
1150
|
options: P2IDEOptions
|
|
1476
1151
|
): ReturnType<WasmModule["Note"]["createP2IDENote"]>;
|
|
1477
1152
|
|
|
1478
|
-
/**
|
|
1479
|
-
* Builds (without submitting) a Public custom-script note carrying a
|
|
1480
|
-
* `NetworkAccountTarget` attachment. Provide exactly one of `recipient` or
|
|
1481
|
-
* `script`.
|
|
1482
|
-
*/
|
|
1483
|
-
export declare function buildNetworkNote(opts: NetworkNoteOptions): Note;
|
|
1484
|
-
|
|
1485
1153
|
/** Builds a swap tag for note matching. Returns a NoteTag (use `.asU32()` for the numeric value). */
|
|
1486
1154
|
export declare function buildSwapTag(
|
|
1487
1155
|
options: BuildSwapTagOptions
|
|
Binary file
|