@miden-sdk/miden-sdk 0.13.0-next.1 → 0.13.0-next.3
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 +2 -2
- package/dist/{workers/Cargo-15e14c5a-15e14c5a.js → Cargo-eb2eb6d6.js} +9580 -4921
- package/dist/Cargo-eb2eb6d6.js.map +1 -0
- package/dist/assets/miden_client_web.wasm +0 -0
- package/dist/crates/miden_client_web.d.ts +2540 -447
- package/dist/index.d.ts +129 -101
- package/dist/index.js +501 -129
- package/dist/index.js.map +1 -1
- package/dist/wasm.js +1 -1
- package/dist/{Cargo-15e14c5a.js → workers/Cargo-eb2eb6d6-eb2eb6d6.js} +9580 -4921
- package/dist/workers/Cargo-eb2eb6d6-eb2eb6d6.js.map +1 -0
- package/dist/workers/assets/miden_client_web.wasm +0 -0
- package/dist/workers/web-client-methods-worker.js +233 -23
- package/dist/workers/web-client-methods-worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/Cargo-15e14c5a.js.map +0 -1
- package/dist/workers/Cargo-15e14c5a-15e14c5a.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,113 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
AccountFile,
|
|
9
|
-
AccountHeader,
|
|
10
|
-
AccountId,
|
|
11
|
-
AccountInterface,
|
|
12
|
-
AccountStorageDelta,
|
|
13
|
-
AccountStorageMode,
|
|
14
|
-
AccountStorageRequirements,
|
|
15
|
-
AccountType,
|
|
16
|
-
AccountVaultDelta,
|
|
17
|
-
Address,
|
|
18
|
-
AddressInterface,
|
|
19
|
-
AdviceMap,
|
|
20
|
-
Assembler,
|
|
21
|
-
AssemblerUtils,
|
|
22
|
-
AuthSecretKey,
|
|
23
|
-
BasicFungibleFaucetComponent,
|
|
24
|
-
ConsumableNoteRecord,
|
|
25
|
-
Endpoint,
|
|
26
|
-
Felt,
|
|
27
|
-
FeltArray,
|
|
28
|
-
ForeignAccount,
|
|
29
|
-
FungibleAsset,
|
|
30
|
-
FungibleAssetDelta,
|
|
31
|
-
InputNoteRecord,
|
|
32
|
-
InputNoteState,
|
|
33
|
-
Library,
|
|
34
|
-
MidenArrays,
|
|
35
|
-
NetworkId,
|
|
36
|
-
Note,
|
|
37
|
-
NoteAndArgs,
|
|
38
|
-
NoteAndArgsArray,
|
|
39
|
-
NoteAssets,
|
|
40
|
-
NoteConsumability,
|
|
41
|
-
NoteDetails,
|
|
42
|
-
NoteExecutionHint,
|
|
43
|
-
NoteExecutionMode,
|
|
44
|
-
NoteFile,
|
|
45
|
-
NoteFilter,
|
|
46
|
-
NoteFilterTypes,
|
|
47
|
-
NoteId,
|
|
48
|
-
NoteIdAndArgs,
|
|
49
|
-
NoteIdAndArgsArray,
|
|
50
|
-
NoteInputs,
|
|
51
|
-
NoteMetadata,
|
|
52
|
-
NoteRecipient,
|
|
53
|
-
NoteScript,
|
|
54
|
-
NoteTag,
|
|
55
|
-
NoteType,
|
|
56
|
-
OutputNote,
|
|
57
|
-
OutputNotesArray,
|
|
58
|
-
Package,
|
|
59
|
-
PublicKey,
|
|
60
|
-
Rpo256,
|
|
61
|
-
RpcClient,
|
|
62
|
-
SecretKey,
|
|
63
|
-
ProvenTransaction,
|
|
64
|
-
SerializedAccountHeader,
|
|
65
|
-
Signature,
|
|
66
|
-
SigningInputs,
|
|
67
|
-
SigningInputsType,
|
|
68
|
-
SlotAndKeys,
|
|
69
|
-
SlotAndKeysArray,
|
|
70
|
-
StorageMap,
|
|
71
|
-
StorageSlot,
|
|
72
|
-
TestUtils,
|
|
73
|
-
TokenSymbol,
|
|
74
|
-
TransactionFilter,
|
|
75
|
-
TransactionId,
|
|
76
|
-
TransactionKernel,
|
|
1
|
+
// Re-export everything from the WASM module
|
|
2
|
+
export * from "./crates/miden_client_web";
|
|
3
|
+
|
|
4
|
+
// Import types we need for augmentation
|
|
5
|
+
import type {
|
|
6
|
+
WebClient as WasmWebClient,
|
|
7
|
+
SyncSummary,
|
|
77
8
|
TransactionProver,
|
|
78
|
-
TransactionRecord,
|
|
79
|
-
TransactionRequest,
|
|
80
|
-
TransactionResult,
|
|
81
|
-
TransactionStoreUpdate,
|
|
82
|
-
TransactionRequestBuilder,
|
|
83
|
-
TransactionScript,
|
|
84
|
-
TransactionScriptInputPair,
|
|
85
|
-
TransactionScriptInputPairArray,
|
|
86
|
-
TransactionSummary,
|
|
87
|
-
Word,
|
|
88
9
|
} from "./crates/miden_client_web";
|
|
89
10
|
|
|
90
|
-
//
|
|
91
|
-
|
|
11
|
+
// Import the full namespace for the MidenArrayConstructors type
|
|
12
|
+
import type * as WasmExports from "./crates/miden_client_web";
|
|
13
|
+
|
|
14
|
+
// Export the WASM WebClient type alias for users who need to reference it explicitly
|
|
15
|
+
export type { WebClient as WasmWebClient } from "./crates/miden_client_web";
|
|
16
|
+
|
|
17
|
+
// Callback types for external keystore support
|
|
18
|
+
export type GetKeyCallback = (
|
|
19
|
+
pubKey: Uint8Array
|
|
20
|
+
) => Promise<Uint8Array | null | undefined> | Uint8Array | null | undefined;
|
|
21
|
+
|
|
22
|
+
export type InsertKeyCallback = (
|
|
23
|
+
pubKey: Uint8Array,
|
|
24
|
+
secretKey: Uint8Array
|
|
25
|
+
) => Promise<void> | void;
|
|
26
|
+
|
|
27
|
+
export type SignCallback = (
|
|
28
|
+
pubKey: Uint8Array,
|
|
29
|
+
signingInputs: Uint8Array
|
|
30
|
+
) => Promise<Uint8Array> | Uint8Array;
|
|
31
|
+
|
|
32
|
+
type MidenArrayConstructors = {
|
|
33
|
+
[K in keyof typeof WasmExports as K extends `${string}Array`
|
|
34
|
+
? K
|
|
35
|
+
: never]: (typeof WasmExports)[K];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export declare const MidenArrays: MidenArrayConstructors;
|
|
39
|
+
|
|
40
|
+
// Module augmentation to add JavaScript wrapper methods to WebClient
|
|
41
|
+
declare module "./crates/miden_client_web" {
|
|
42
|
+
interface WebClient {
|
|
43
|
+
/**
|
|
44
|
+
* Factory method to create and initialize a new wrapped WebClient.
|
|
45
|
+
*
|
|
46
|
+
* @param rpcUrl - The RPC URL (optional).
|
|
47
|
+
* @param noteTransportUrl - The note transport URL (optional).
|
|
48
|
+
* @param seed - The seed for the account (optional).
|
|
49
|
+
* @param network - Optional name for the store. Setting this allows multiple clients to be used in the same browser.
|
|
50
|
+
* @returns A promise that resolves to a fully initialized WebClient.
|
|
51
|
+
*/
|
|
52
|
+
createClient(
|
|
53
|
+
rpcUrl?: string,
|
|
54
|
+
noteTransportUrl?: string,
|
|
55
|
+
seed?: Uint8Array,
|
|
56
|
+
network?: string
|
|
57
|
+
): Promise<WebClient>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Factory method to create and initialize a new wrapped WebClient with a remote keystore.
|
|
61
|
+
*
|
|
62
|
+
* @param rpcUrl - The RPC URL (optional).
|
|
63
|
+
* @param noteTransportUrl - The note transport URL (optional).
|
|
64
|
+
* @param seed - The seed for the account (optional).
|
|
65
|
+
* @param storeName - Optional name for the store. Setting this allows multiple clients to be used in the same browser.
|
|
66
|
+
* @param getKeyCb - Callback used to retrieve secret keys for a given public key.
|
|
67
|
+
* @param insertKeyCb - Callback used to persist secret keys in the external store.
|
|
68
|
+
* @param signCb - Callback used to create signatures for the provided inputs.
|
|
69
|
+
* @returns A promise that resolves to a fully initialized WebClient.
|
|
70
|
+
*/
|
|
71
|
+
createClientWithExternalKeystore(
|
|
72
|
+
rpcUrl?: string,
|
|
73
|
+
noteTransportUrl?: string,
|
|
74
|
+
seed?: Uint8Array,
|
|
75
|
+
storeName?: string,
|
|
76
|
+
getKeyCb?: GetKeyCallback,
|
|
77
|
+
insertKeyCb?: InsertKeyCallback,
|
|
78
|
+
signCb?: SignCallback
|
|
79
|
+
): Promise<WebClient>;
|
|
80
|
+
|
|
81
|
+
/** Returns the default transaction prover configured on the client. */
|
|
82
|
+
defaultTransactionProver(): TransactionProver;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Syncs the client state with the Miden node.
|
|
86
|
+
*
|
|
87
|
+
* This method coordinates concurrent calls using the Web Locks API:
|
|
88
|
+
* - If a sync is already in progress, callers wait and receive the same result
|
|
89
|
+
* - Cross-tab coordination ensures only one sync runs at a time per database
|
|
90
|
+
*
|
|
91
|
+
* @returns A promise that resolves to a SyncSummary with the sync results.
|
|
92
|
+
*/
|
|
93
|
+
syncState(): Promise<SyncSummary>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Syncs the client state with the Miden node with an optional timeout.
|
|
97
|
+
*
|
|
98
|
+
* This method coordinates concurrent calls using the Web Locks API:
|
|
99
|
+
* - If a sync is already in progress, callers wait and receive the same result
|
|
100
|
+
* - Cross-tab coordination ensures only one sync runs at a time per database
|
|
101
|
+
* - If a timeout is specified and exceeded, the method throws an error
|
|
102
|
+
*
|
|
103
|
+
* @param timeoutMs - Optional timeout in milliseconds. If 0 or not provided, waits indefinitely.
|
|
104
|
+
* @returns A promise that resolves to a SyncSummary with the sync results.
|
|
105
|
+
*/
|
|
106
|
+
syncStateWithTimeout(timeoutMs?: number): Promise<SyncSummary>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Terminates the underlying worker.
|
|
110
|
+
*/
|
|
111
|
+
terminate(): void;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// MockWebClient class that extends the augmented WebClient
|
|
116
|
+
export declare class MockWebClient extends WasmWebClient {
|
|
92
117
|
/**
|
|
93
|
-
* Factory method to create and initialize a new wrapped
|
|
118
|
+
* Factory method to create and initialize a new wrapped MockWebClient.
|
|
94
119
|
*
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @param seed -
|
|
98
|
-
* @returns A promise that resolves to a fully initialized
|
|
120
|
+
* @param serializedMockChain - Serialized mock chain (optional).
|
|
121
|
+
* @param serializedMockNoteTransportNode - Serialized mock note transport node (optional).
|
|
122
|
+
* @param seed - Seed for account initialization (optional).
|
|
123
|
+
* @returns A promise that resolves to a fully initialized MockWebClient.
|
|
99
124
|
*/
|
|
100
125
|
static createClient(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
seed?:
|
|
104
|
-
): Promise<
|
|
126
|
+
serializedMockChain?: ArrayBuffer | Uint8Array,
|
|
127
|
+
serializedMockNoteTransportNode?: ArrayBuffer | Uint8Array,
|
|
128
|
+
seed?: Uint8Array
|
|
129
|
+
): Promise<MockWebClient>;
|
|
105
130
|
|
|
106
|
-
/**
|
|
107
|
-
|
|
131
|
+
/** Syncs the mock state and returns the resulting summary. */
|
|
132
|
+
syncState(): Promise<SyncSummary>;
|
|
108
133
|
|
|
109
134
|
/**
|
|
110
|
-
*
|
|
135
|
+
* Syncs the client state with the Miden node with an optional timeout.
|
|
136
|
+
*
|
|
137
|
+
* @param timeoutMs - Optional timeout in milliseconds. If 0 or not provided, waits indefinitely.
|
|
138
|
+
* @returns A promise that resolves to a SyncSummary with the sync results.
|
|
111
139
|
*/
|
|
112
|
-
|
|
140
|
+
syncStateWithTimeout(timeoutMs?: number): Promise<SyncSummary>;
|
|
113
141
|
}
|