@miden-sdk/miden-sdk 0.14.11 → 0.15.0-alpha.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.
- package/dist/mt/{Cargo-CZopJ--X.js → Cargo-smJQCGjz.js} +1111 -768
- package/dist/mt/Cargo-smJQCGjz.js.map +1 -0
- package/dist/mt/api-types.d.ts +122 -33
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +376 -303
- package/dist/mt/docs-entry.d.ts +3 -0
- package/dist/mt/eager.js +7 -4
- package/dist/mt/eager.js.map +1 -1
- package/dist/mt/index.d.ts +103 -10
- package/dist/mt/index.js +669 -312
- 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-CZopJ--X-SsyOTzpb.js → Cargo-smJQCGjz-q4GYXDiD.js} +1111 -768
- package/dist/mt/workers/Cargo-smJQCGjz-q4GYXDiD.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +1140 -792
- package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js +23 -19
- 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-DC6jSekr.js → Cargo-CG4XszZo.js} +1105 -763
- package/dist/st/Cargo-CG4XszZo.js.map +1 -0
- package/dist/st/api-types.d.ts +122 -33
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +376 -303
- package/dist/st/docs-entry.d.ts +3 -0
- package/dist/st/eager.js +7 -4
- package/dist/st/eager.js.map +1 -1
- package/dist/st/index.d.ts +103 -10
- package/dist/st/index.js +669 -312
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-DC6jSekr-BG7C7m56.js → Cargo-CG4XszZo-S7EHAZSa.js} +1105 -763
- package/dist/st/workers/Cargo-CG4XszZo-S7EHAZSa.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +1134 -787
- package/dist/st/workers/web-client-methods-worker.js.map +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js +23 -19
- package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/client.js +491 -0
- package/js/node/client-factory.js +117 -0
- package/js/node/loader.js +138 -0
- package/js/node/napi-compat.js +253 -0
- package/js/node-index.js +194 -0
- package/js/resources/accounts.js +222 -0
- package/js/resources/compiler.js +74 -0
- package/js/resources/keystore.js +54 -0
- package/js/resources/notes.js +124 -0
- package/js/resources/settings.js +30 -0
- package/js/resources/tags.js +31 -0
- package/js/resources/transactions.js +667 -0
- package/js/standalone.js +109 -0
- package/js/utils.js +232 -0
- package/package.json +17 -2
- package/dist/mt/Cargo-CZopJ--X.js.map +0 -1
- package/dist/mt/workers/Cargo-CZopJ--X-SsyOTzpb.js.map +0 -1
- package/dist/st/Cargo-DC6jSekr.js.map +0 -1
- package/dist/st/workers/Cargo-DC6jSekr-BG7C7m56.js.map +0 -1
package/dist/mt/api-types.d.ts
CHANGED
|
@@ -84,25 +84,9 @@ export declare const AuthScheme: {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Union of all
|
|
88
|
-
* `AuthScheme` value so `authScheme?: AuthScheme` resolves to
|
|
89
|
-
* `"falcon" | "ecdsa"` in type position while `AuthScheme.Falcon` /
|
|
90
|
-
* `AuthScheme.ECDSA` still work in value position.
|
|
87
|
+
* Union of all values in the AuthScheme const.
|
|
91
88
|
*/
|
|
92
|
-
export type
|
|
93
|
-
|
|
94
|
-
/** @deprecated Alias for `AuthScheme` (the string union). */
|
|
95
|
-
export type AuthSchemeType = AuthScheme;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Resolves an `AuthScheme` string to the numeric value expected by low-level
|
|
99
|
-
* wasm-bindgen methods such as
|
|
100
|
-
* `AccountComponent.createAuthComponentFromCommitment(commitment, scheme)`.
|
|
101
|
-
*
|
|
102
|
-
* @param scheme - `AuthScheme.Falcon` or `AuthScheme.ECDSA`. Defaults to `"falcon"`.
|
|
103
|
-
* @returns The numeric AuthScheme enum value.
|
|
104
|
-
*/
|
|
105
|
-
export declare function resolveAuthScheme(scheme?: AuthScheme): number;
|
|
89
|
+
export type AuthSchemeType = (typeof AuthScheme)[keyof typeof AuthScheme];
|
|
106
90
|
|
|
107
91
|
/**
|
|
108
92
|
* User-friendly note visibility constants.
|
|
@@ -118,16 +102,20 @@ export type NoteVisibility = "public" | "private";
|
|
|
118
102
|
|
|
119
103
|
/**
|
|
120
104
|
* User-friendly storage mode constants.
|
|
121
|
-
* Use `StorageMode.Public
|
|
105
|
+
* Use `StorageMode.Public` or `StorageMode.Private` instead of raw strings.
|
|
106
|
+
*
|
|
107
|
+
* The `"network"` storage mode was removed in the migration to miden-client
|
|
108
|
+
* PR #2214 — the 0.15 protocol surface no longer has a separate
|
|
109
|
+
* network-account flag (network execution is now driven by the calling
|
|
110
|
+
* surface, not the account's storage mode).
|
|
122
111
|
*/
|
|
123
112
|
export declare const StorageMode: {
|
|
124
113
|
readonly Public: "public";
|
|
125
114
|
readonly Private: "private";
|
|
126
|
-
readonly Network: "network";
|
|
127
115
|
};
|
|
128
116
|
|
|
129
117
|
/** Union of valid StorageMode string values. */
|
|
130
|
-
export type StorageMode = "public" | "private"
|
|
118
|
+
export type StorageMode = "public" | "private";
|
|
131
119
|
|
|
132
120
|
/**
|
|
133
121
|
* Library linking mode for script compilation.
|
|
@@ -203,6 +191,8 @@ export interface ClientOptions {
|
|
|
203
191
|
storeName?: string;
|
|
204
192
|
/** Sync state on creation (default: false). */
|
|
205
193
|
autoSync?: boolean;
|
|
194
|
+
/** Enable debug mode for transaction execution (default: false). */
|
|
195
|
+
debugMode?: boolean;
|
|
206
196
|
/** External keystore callbacks. */
|
|
207
197
|
keystore?: {
|
|
208
198
|
getKey: GetKeyCallback;
|
|
@@ -270,6 +260,8 @@ export interface WalletCreateOptions {
|
|
|
270
260
|
export interface FaucetCreateOptions {
|
|
271
261
|
/** Use `AccountType.FungibleFaucet` or `AccountType.NonFungibleFaucet`. */
|
|
272
262
|
type: AccountTypeValue;
|
|
263
|
+
/** Human-readable token name. Defaults to `symbol` when omitted. */
|
|
264
|
+
name?: string;
|
|
273
265
|
symbol: string;
|
|
274
266
|
decimals: number;
|
|
275
267
|
maxSupply: number | bigint;
|
|
@@ -407,6 +399,41 @@ export interface SwapOptions extends TransactionOptions {
|
|
|
407
399
|
paybackType?: NoteVisibility;
|
|
408
400
|
}
|
|
409
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Options for {@link TransactionsResource.pswapCreate}. V1 PSWAP notes carry
|
|
404
|
+
* no attachment, so there is no `attachment` field.
|
|
405
|
+
*/
|
|
406
|
+
export interface PswapCreateOptions extends TransactionOptions {
|
|
407
|
+
/** Account that creates the partial-swap (PSWAP) note. */
|
|
408
|
+
account: AccountRef;
|
|
409
|
+
/** Fungible asset offered by the creator. */
|
|
410
|
+
offer: Asset;
|
|
411
|
+
/** Fungible asset requested in exchange. */
|
|
412
|
+
request: Asset;
|
|
413
|
+
/** Visibility of the PSWAP note itself. */
|
|
414
|
+
type?: NoteVisibility;
|
|
415
|
+
/** Visibility of the payback note fillers emit to the creator. Defaults to `public`. */
|
|
416
|
+
paybackType?: NoteVisibility;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface PswapConsumeOptions extends TransactionOptions {
|
|
420
|
+
/** Consumer account filling the PSWAP note. */
|
|
421
|
+
account: AccountRef;
|
|
422
|
+
/** PSWAP note to consume — accepts a note id (hex), `NoteId`, `InputNoteRecord`, or `Note`. */
|
|
423
|
+
note: NoteInput;
|
|
424
|
+
/** Requested-asset amount the consumer supplies from its own vault; a partial amount emits a remainder PSWAP note. */
|
|
425
|
+
fillAmount: number | bigint;
|
|
426
|
+
/** Requested-asset amount supplied by other in-flight notes in the same tx. Defaults to `0`; leave unset normally. */
|
|
427
|
+
noteFillAmount?: number | bigint;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface PswapCancelOptions extends TransactionOptions {
|
|
431
|
+
/** Creator account reclaiming the offered asset. */
|
|
432
|
+
account: AccountRef;
|
|
433
|
+
/** PSWAP note to cancel — accepts a note id (hex), `NoteId`, `InputNoteRecord`, or `Note`. */
|
|
434
|
+
note: NoteInput;
|
|
435
|
+
}
|
|
436
|
+
|
|
410
437
|
export interface ExecuteOptions extends TransactionOptions {
|
|
411
438
|
/** Account executing the custom script. */
|
|
412
439
|
account: AccountRef;
|
|
@@ -467,11 +494,44 @@ export interface PreviewSwapOptions {
|
|
|
467
494
|
paybackType?: NoteVisibility;
|
|
468
495
|
}
|
|
469
496
|
|
|
497
|
+
export interface PreviewPswapCreateOptions {
|
|
498
|
+
operation: "pswapCreate";
|
|
499
|
+
account: AccountRef;
|
|
500
|
+
offer: Asset;
|
|
501
|
+
request: Asset;
|
|
502
|
+
type?: NoteVisibility;
|
|
503
|
+
paybackType?: NoteVisibility;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export interface PreviewPswapConsumeOptions {
|
|
507
|
+
operation: "pswapConsume";
|
|
508
|
+
account: AccountRef;
|
|
509
|
+
note: NoteInput;
|
|
510
|
+
fillAmount: number | bigint;
|
|
511
|
+
noteFillAmount?: number | bigint;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export interface PreviewPswapCancelOptions {
|
|
515
|
+
operation: "pswapCancel";
|
|
516
|
+
account: AccountRef;
|
|
517
|
+
note: NoteInput;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export interface PreviewCustomOptions {
|
|
521
|
+
operation: "custom";
|
|
522
|
+
account: AccountRef;
|
|
523
|
+
request: TransactionRequest;
|
|
524
|
+
}
|
|
525
|
+
|
|
470
526
|
export type PreviewOptions =
|
|
471
527
|
| PreviewSendOptions
|
|
472
528
|
| PreviewMintOptions
|
|
473
529
|
| PreviewConsumeOptions
|
|
474
|
-
| PreviewSwapOptions
|
|
530
|
+
| PreviewSwapOptions
|
|
531
|
+
| PreviewPswapCreateOptions
|
|
532
|
+
| PreviewPswapConsumeOptions
|
|
533
|
+
| PreviewPswapCancelOptions
|
|
534
|
+
| PreviewCustomOptions;
|
|
475
535
|
|
|
476
536
|
/** Status values reported during waitFor polling. */
|
|
477
537
|
export type WaitStatus = "pending" | "submitted" | "committed";
|
|
@@ -551,12 +611,6 @@ export interface MockOptions {
|
|
|
551
611
|
serializedNoteTransport?: Uint8Array;
|
|
552
612
|
}
|
|
553
613
|
|
|
554
|
-
/** Versioned store snapshot for backup/restore. */
|
|
555
|
-
export interface StoreSnapshot {
|
|
556
|
-
version: number;
|
|
557
|
-
data: unknown;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
614
|
// ════════════════════════════════════════════════════════════════
|
|
561
615
|
// Swap tag options
|
|
562
616
|
// ════════════════════════════════════════════════════════════════
|
|
@@ -682,6 +736,31 @@ export interface TransactionsResource {
|
|
|
682
736
|
* @param options - Swap options including the account, offered asset, and requested asset.
|
|
683
737
|
*/
|
|
684
738
|
swap(options: SwapOptions): Promise<TransactionSubmitResult>;
|
|
739
|
+
/**
|
|
740
|
+
* Create a partial-swap (PSWAP) note offering one fungible asset for
|
|
741
|
+
* another. Unlike `swap`, the resulting note can be filled by multiple
|
|
742
|
+
* consumers; each fill emits a payback note to the creator and, on a
|
|
743
|
+
* partial fill, a remainder PSWAP note carrying the unfilled amount.
|
|
744
|
+
*
|
|
745
|
+
* @param options - Creator, offered asset, requested asset, and visibility.
|
|
746
|
+
*/
|
|
747
|
+
pswapCreate(options: PswapCreateOptions): Promise<TransactionSubmitResult>;
|
|
748
|
+
/**
|
|
749
|
+
* Consume (fully or partially fill) an existing PSWAP note. The consumer
|
|
750
|
+
* supplies `fillAmount` of the requested asset and receives a proportional
|
|
751
|
+
* share of the offered asset. A full fill (`fillAmount` equal to the
|
|
752
|
+
* note's requested amount) produces only the payback note; a partial fill
|
|
753
|
+
* also produces a remainder PSWAP note.
|
|
754
|
+
*
|
|
755
|
+
* @param options - Consumer account, PSWAP note, and fill amount.
|
|
756
|
+
*/
|
|
757
|
+
pswapConsume(options: PswapConsumeOptions): Promise<TransactionSubmitResult>;
|
|
758
|
+
/**
|
|
759
|
+
* Cancel a PSWAP note as the creator and reclaim the offered asset.
|
|
760
|
+
*
|
|
761
|
+
* @param options - Creator account and PSWAP note to cancel.
|
|
762
|
+
*/
|
|
763
|
+
pswapCancel(options: PswapCancelOptions): Promise<TransactionSubmitResult>;
|
|
685
764
|
/**
|
|
686
765
|
* Consume all available notes for an account, up to an optional limit.
|
|
687
766
|
* Returns the count of remaining notes for pagination.
|
|
@@ -770,8 +849,13 @@ export interface NotesResource {
|
|
|
770
849
|
* Import a note from a {@link NoteFile}.
|
|
771
850
|
*
|
|
772
851
|
* @param noteFile - The note file to import.
|
|
852
|
+
* @returns The imported note's id (hex) when the file carries metadata (a
|
|
853
|
+
* note id or a full note with proof); for a details-only file, which has no
|
|
854
|
+
* note id yet, the note's details commitment (hex) is returned instead.
|
|
855
|
+
* In both cases the value is a hex string, not a `NoteId` object — pass it
|
|
856
|
+
* to {@link NoteId.fromHex} if a `NoteId` instance is required.
|
|
773
857
|
*/
|
|
774
|
-
import(noteFile: NoteFile): Promise<
|
|
858
|
+
import(noteFile: NoteFile): Promise<string>;
|
|
775
859
|
/**
|
|
776
860
|
* Export a note to a {@link NoteFile} for transfer or backup.
|
|
777
861
|
*
|
|
@@ -996,6 +1080,11 @@ export declare class MidenClient {
|
|
|
996
1080
|
* happened yet). Useful for recovering structured metadata (e.g. a
|
|
997
1081
|
* `reason: 'locked'` property) that the kernel-level `auth::request`
|
|
998
1082
|
* diagnostic would otherwise erase.
|
|
1083
|
+
*
|
|
1084
|
+
* Meaningful only with `useWorker: false` (the worker shim's keystore
|
|
1085
|
+
* lives in the worker WASM instance, so this reads `null` there). On
|
|
1086
|
+
* the Node.js binding it always returns `null` — signing goes through
|
|
1087
|
+
* the filesystem keystore, never a JS callback.
|
|
999
1088
|
*/
|
|
1000
1089
|
lastAuthError(): unknown;
|
|
1001
1090
|
/** Returns the client-level default prover. */
|
|
@@ -1004,16 +1093,16 @@ export declare class MidenClient {
|
|
|
1004
1093
|
terminate(): void;
|
|
1005
1094
|
|
|
1006
1095
|
/** Returns the identifier of the underlying store (e.g. IndexedDB database name, file path). */
|
|
1007
|
-
storeIdentifier(): string
|
|
1096
|
+
storeIdentifier(): Promise<string>;
|
|
1008
1097
|
|
|
1009
1098
|
/** Advances the mock chain by one block. Only available on mock clients. */
|
|
1010
|
-
proveBlock(): void
|
|
1099
|
+
proveBlock(): Promise<void>;
|
|
1011
1100
|
/** Returns true if this client uses a mock chain. */
|
|
1012
1101
|
usesMockChain(): boolean;
|
|
1013
1102
|
/** Serializes the mock chain state for snapshot/restore in tests. */
|
|
1014
|
-
serializeMockChain(): Uint8Array
|
|
1103
|
+
serializeMockChain(): Promise<Uint8Array>;
|
|
1015
1104
|
/** Serializes the mock note transport node state. */
|
|
1016
|
-
serializeMockNoteTransportNode(): Uint8Array
|
|
1105
|
+
serializeMockNoteTransportNode(): Promise<Uint8Array>;
|
|
1017
1106
|
|
|
1018
1107
|
[Symbol.dispose](): void;
|
|
1019
1108
|
[Symbol.asyncDispose](): Promise<void>;
|
|
Binary file
|