@miden-sdk/miden-sdk 0.15.4 → 0.15.6
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 +29 -0
- package/dist/mt/{Cargo-DjVnfWKi.js → Cargo-mvyTli7g.js} +364 -88
- package/dist/mt/Cargo-mvyTli7g.js.map +1 -0
- package/dist/mt/api-types.d.ts +59 -0
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +108 -1
- package/dist/mt/docs-entry.d.ts +1 -0
- package/dist/mt/eager.js +1 -1
- package/dist/mt/index.js +92 -1
- 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-DjVnfWKi-DvLbB_Zb.js → Cargo-mvyTli7g-BwMMSyoq.js} +364 -88
- package/dist/mt/workers/Cargo-mvyTli7g-BwMMSyoq.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +365 -88
- 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-Cwpuvlbc.js → Cargo-Cysp4vto.js} +371 -96
- package/dist/st/Cargo-Cysp4vto.js.map +1 -0
- package/dist/st/api-types.d.ts +59 -0
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +108 -1
- package/dist/st/docs-entry.d.ts +1 -0
- package/dist/st/eager.js +1 -1
- package/dist/st/index.js +92 -1
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-Cwpuvlbc-B0V_MEMU.js → Cargo-Cysp4vto-BIw-TeJn.js} +371 -96
- package/dist/st/workers/Cargo-Cysp4vto-BIw-TeJn.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +372 -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 +3 -0
- package/js/resources/transactions.js +91 -0
- package/js/standalone.js +61 -0
- package/package.json +4 -4
- package/dist/mt/Cargo-DjVnfWKi.js.map +0 -1
- package/dist/mt/workers/Cargo-DjVnfWKi-DvLbB_Zb.js.map +0 -1
- package/dist/st/Cargo-Cwpuvlbc.js.map +0 -1
- package/dist/st/workers/Cargo-Cwpuvlbc-B0V_MEMU.js.map +0 -1
package/dist/st/api-types.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ import type {
|
|
|
30
30
|
AccountStorageRequirements,
|
|
31
31
|
TransactionScript,
|
|
32
32
|
NoteScript,
|
|
33
|
+
NoteRecipient,
|
|
34
|
+
NoteExecutionHint,
|
|
35
|
+
NetworkAccountTarget,
|
|
33
36
|
AdviceInputs,
|
|
34
37
|
FeltArray,
|
|
35
38
|
PswapLineageRecord,
|
|
@@ -357,6 +360,48 @@ export interface SendResult {
|
|
|
357
360
|
result: TransactionResult;
|
|
358
361
|
}
|
|
359
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Options for {@link TransactionsResource.createNetworkNote} and the standalone
|
|
365
|
+
* {@link buildNetworkNote}. Builds a Public, custom-script note carrying a
|
|
366
|
+
* `NetworkAccountTarget` attachment so a public network account auto-consumes it.
|
|
367
|
+
*
|
|
368
|
+
* Provide exactly one of `recipient` or `script`.
|
|
369
|
+
*/
|
|
370
|
+
export interface NetworkNoteOptions extends TransactionOptions {
|
|
371
|
+
/** Account that creates, funds, and submits the note (the executing sender). */
|
|
372
|
+
account: AccountRef;
|
|
373
|
+
/**
|
|
374
|
+
* The network account the note targets. Any account reference, or a pre-built
|
|
375
|
+
* `NetworkAccountTarget`. Encoded as the note's `NetworkAccountTarget`
|
|
376
|
+
* attachment — this is what makes `isNetworkNote()` true.
|
|
377
|
+
*/
|
|
378
|
+
target: AccountRef | NetworkAccountTarget;
|
|
379
|
+
/** Execution hint when `target` is an account reference. Defaults to `always`. */
|
|
380
|
+
executionHint?: NoteExecutionHint;
|
|
381
|
+
/**
|
|
382
|
+
* Recipient carrying the note's custom consumption script. Build with
|
|
383
|
+
* `new NoteRecipient(serialNum, noteScript, noteStorage)`, or omit and pass
|
|
384
|
+
* `script` to have the recipient built for you.
|
|
385
|
+
*/
|
|
386
|
+
recipient?: NoteRecipient;
|
|
387
|
+
/** Custom consumption script; the recipient is built with a fresh serial number. */
|
|
388
|
+
script?: NoteScript;
|
|
389
|
+
/** Note storage / inputs the script reads (used with `script`). */
|
|
390
|
+
inputs?: bigint[];
|
|
391
|
+
/** Assets locked into the note. Optional — a note may carry no assets. */
|
|
392
|
+
assets?: Asset | Asset[];
|
|
393
|
+
/** Extra attachment payload appended AFTER the required `NetworkAccountTarget`. */
|
|
394
|
+
attachment?: bigint[];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Result of {@link TransactionsResource.createNetworkNote}. */
|
|
398
|
+
export interface NetworkNoteResult {
|
|
399
|
+
txId: TransactionId;
|
|
400
|
+
/** The built network note (read its id / attachments). */
|
|
401
|
+
note: Note;
|
|
402
|
+
result: TransactionResult;
|
|
403
|
+
}
|
|
404
|
+
|
|
360
405
|
/** Result of methods that previously returned bare TransactionId. */
|
|
361
406
|
export interface TransactionSubmitResult {
|
|
362
407
|
txId: TransactionId;
|
|
@@ -823,6 +868,13 @@ export interface TransactionsResource {
|
|
|
823
868
|
* @param options - Mint options including the faucet, recipient, and amount.
|
|
824
869
|
*/
|
|
825
870
|
mint(options: MintOptions): Promise<TransactionSubmitResult>;
|
|
871
|
+
/**
|
|
872
|
+
* Builds a Public custom-script note carrying a `NetworkAccountTarget`
|
|
873
|
+
* attachment, submits it as an own output note, and (optionally) waits for
|
|
874
|
+
* confirmation. The submitted note satisfies `Note.isNetworkNote()`, so a
|
|
875
|
+
* public network account will auto-consume it.
|
|
876
|
+
*/
|
|
877
|
+
createNetworkNote(options: NetworkNoteOptions): Promise<NetworkNoteResult>;
|
|
826
878
|
/**
|
|
827
879
|
* Bridge a fungible asset out to another network via the AggLayer. Emits a
|
|
828
880
|
* single public B2AGG (Bridge-to-AggLayer) note that the bridge account
|
|
@@ -1303,6 +1355,13 @@ export declare function createP2IDENote(
|
|
|
1303
1355
|
options: P2IDEOptions
|
|
1304
1356
|
): ReturnType<WasmModule["Note"]["createP2IDENote"]>;
|
|
1305
1357
|
|
|
1358
|
+
/**
|
|
1359
|
+
* Builds (without submitting) a Public custom-script note carrying a
|
|
1360
|
+
* `NetworkAccountTarget` attachment. Provide exactly one of `recipient` or
|
|
1361
|
+
* `script`.
|
|
1362
|
+
*/
|
|
1363
|
+
export declare function buildNetworkNote(opts: NetworkNoteOptions): Note;
|
|
1364
|
+
|
|
1306
1365
|
/** Builds a swap tag for note matching. Returns a NoteTag (use `.asU32()` for the numeric value). */
|
|
1307
1366
|
export declare function buildSwapTag(
|
|
1308
1367
|
options: BuildSwapTagOptions
|
|
Binary file
|
|
@@ -57,6 +57,13 @@ export class Account {
|
|
|
57
57
|
* Returns true if the account exposes a fungible-faucet interface.
|
|
58
58
|
*/
|
|
59
59
|
isFaucet(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if this is a network account.
|
|
62
|
+
*
|
|
63
|
+
* A network account is a public account whose storage
|
|
64
|
+
* carries the standardized network-account note-script allowlist slot.
|
|
65
|
+
*/
|
|
66
|
+
isNetworkAccount(): boolean;
|
|
60
67
|
/**
|
|
61
68
|
* Returns true if the account has not yet been committed to the chain.
|
|
62
69
|
*/
|
|
@@ -73,6 +80,11 @@ export class Account {
|
|
|
73
80
|
* Returns true if the account is a regular (non-faucet) account.
|
|
74
81
|
*/
|
|
75
82
|
isRegularAccount(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the note-script roots this network account is allowed to
|
|
85
|
+
* consume, or `undefined` if this is not a network account.
|
|
86
|
+
*/
|
|
87
|
+
networkNoteAllowlist(): Word[] | undefined;
|
|
76
88
|
/**
|
|
77
89
|
* Returns the account nonce, which is incremented on every state update.
|
|
78
90
|
*/
|
|
@@ -211,6 +223,29 @@ export class AccountComponent {
|
|
|
211
223
|
* Builds an auth component from a secret key, inferring the auth scheme from the key type.
|
|
212
224
|
*/
|
|
213
225
|
static createAuthComponentFromSecretKey(secret_key: AuthSecretKey): AccountComponent;
|
|
226
|
+
/**
|
|
227
|
+
* Builds the auth component for a network account.
|
|
228
|
+
*
|
|
229
|
+
* A network account is a public account carrying this component: its
|
|
230
|
+
* note-script allowlist is the standardized storage slot the node's
|
|
231
|
+
* network-transaction builder inspects to identify the account as a network
|
|
232
|
+
* account and route matching notes to it for auto-consumption. The account
|
|
233
|
+
* may only consume notes whose script root is in `allowedNoteScriptRoots`
|
|
234
|
+
* (obtain a root via `NoteScript.root()`).
|
|
235
|
+
*
|
|
236
|
+
* `allowedTxScriptRoots` optionally allowlists transaction script roots
|
|
237
|
+
* (from `TransactionScript.root()`) the account will execute. When omitted
|
|
238
|
+
* or empty, the account permits no transaction scripts and deploys and
|
|
239
|
+
* advances via scriptless transactions only. Allowlist a script root only
|
|
240
|
+
* if the script's effect is safe for *every* possible input: a root pins
|
|
241
|
+
* the script's code but not its arguments or advice inputs, which the
|
|
242
|
+
* (arbitrary) transaction submitter controls.
|
|
243
|
+
*
|
|
244
|
+
* # Errors
|
|
245
|
+
* Errors if `allowedNoteScriptRoots` is empty: a network account with no
|
|
246
|
+
* allowlisted note scripts could never consume a note.
|
|
247
|
+
*/
|
|
248
|
+
static createNetworkAuth(allowed_note_script_roots: Word[], allowed_tx_script_roots?: Word[] | null): AccountComponent;
|
|
214
249
|
/**
|
|
215
250
|
* Creates an account component from a compiled library and storage slots.
|
|
216
251
|
*/
|
|
@@ -1113,7 +1148,7 @@ export class CodeBuilder {
|
|
|
1113
1148
|
* Given a Library Path, and a source code, turn it into a Library.
|
|
1114
1149
|
* E.g. A path library can be `miden::my_contract`. When turned into a library,
|
|
1115
1150
|
* this can be used from another script with an import statement, following the
|
|
1116
|
-
* previous example: `use miden::my_contract
|
|
1151
|
+
* previous example: `use miden::my_contract`.
|
|
1117
1152
|
*/
|
|
1118
1153
|
buildLibrary(library_path: string, source_code: string): Library;
|
|
1119
1154
|
/**
|
|
@@ -1751,6 +1786,12 @@ export class InputNoteRecord {
|
|
|
1751
1786
|
* Returns true if the note has already been consumed.
|
|
1752
1787
|
*/
|
|
1753
1788
|
isConsumed(): boolean;
|
|
1789
|
+
/**
|
|
1790
|
+
* Returns true while the note's on-chain inclusion is still unsettled
|
|
1791
|
+
* (`Expected` or `Unverified`), i.e. while sync is the mechanism that can
|
|
1792
|
+
* advance this record.
|
|
1793
|
+
*/
|
|
1794
|
+
isInclusionPending(): boolean;
|
|
1754
1795
|
/**
|
|
1755
1796
|
* Returns true if the note is currently being processed.
|
|
1756
1797
|
*/
|
|
@@ -2113,6 +2154,44 @@ export class MerklePath {
|
|
|
2113
2154
|
verify(index: bigint, node: Word, root: Word): boolean;
|
|
2114
2155
|
}
|
|
2115
2156
|
|
|
2157
|
+
/**
|
|
2158
|
+
* Targets a note at a public network account so the operator auto-consumes it.
|
|
2159
|
+
*
|
|
2160
|
+
* A note is a network note when it is `Public` and carries a valid
|
|
2161
|
+
* `NetworkAccountTarget` attachment (see `Note.isNetworkNote`).
|
|
2162
|
+
*/
|
|
2163
|
+
export class NetworkAccountTarget {
|
|
2164
|
+
free(): void;
|
|
2165
|
+
[Symbol.dispose](): void;
|
|
2166
|
+
/**
|
|
2167
|
+
* Returns the note execution hint.
|
|
2168
|
+
*/
|
|
2169
|
+
executionHint(): NoteExecutionHint;
|
|
2170
|
+
/**
|
|
2171
|
+
* Decodes a `NoteAttachment` back into a `NetworkAccountTarget`.
|
|
2172
|
+
*
|
|
2173
|
+
* # Errors
|
|
2174
|
+
* Errors if the attachment is not a valid network-account-target attachment.
|
|
2175
|
+
*/
|
|
2176
|
+
static fromAttachment(attachment: NoteAttachment): NetworkAccountTarget;
|
|
2177
|
+
/**
|
|
2178
|
+
* Creates a target for the given network account. `executionHint` defaults
|
|
2179
|
+
* to `NoteExecutionHint.always()`.
|
|
2180
|
+
*
|
|
2181
|
+
* # Errors
|
|
2182
|
+
* Errors if `account_id` is not a public account.
|
|
2183
|
+
*/
|
|
2184
|
+
constructor(account_id: AccountId, execution_hint?: NoteExecutionHint | null);
|
|
2185
|
+
/**
|
|
2186
|
+
* Returns the targeted network account id.
|
|
2187
|
+
*/
|
|
2188
|
+
targetId(): AccountId;
|
|
2189
|
+
/**
|
|
2190
|
+
* Encodes this target as a `NoteAttachment`.
|
|
2191
|
+
*/
|
|
2192
|
+
toAttachment(): NoteAttachment;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2116
2195
|
/**
|
|
2117
2196
|
* The identifier of a Miden network.
|
|
2118
2197
|
*/
|
|
@@ -2193,6 +2272,10 @@ export class Note {
|
|
|
2193
2272
|
* Returns the assets locked inside the note.
|
|
2194
2273
|
*/
|
|
2195
2274
|
assets(): NoteAssets;
|
|
2275
|
+
/**
|
|
2276
|
+
* Returns the note's attachments.
|
|
2277
|
+
*/
|
|
2278
|
+
attachments(): NoteAttachment[];
|
|
2196
2279
|
/**
|
|
2197
2280
|
* Returns the commitment to the note (its ID).
|
|
2198
2281
|
*
|
|
@@ -2228,6 +2311,11 @@ export class Note {
|
|
|
2228
2311
|
* Returns the unique identifier of the note.
|
|
2229
2312
|
*/
|
|
2230
2313
|
id(): NoteId;
|
|
2314
|
+
/**
|
|
2315
|
+
* Returns true if the note is a network note (public + a valid
|
|
2316
|
+
* `NetworkAccountTarget` attachment).
|
|
2317
|
+
*/
|
|
2318
|
+
isNetworkNote(): boolean;
|
|
2231
2319
|
/**
|
|
2232
2320
|
* Returns the public metadata associated with the note.
|
|
2233
2321
|
*/
|
|
@@ -2256,6 +2344,14 @@ export class Note {
|
|
|
2256
2344
|
* Serializes the note into bytes.
|
|
2257
2345
|
*/
|
|
2258
2346
|
serialize(): Uint8Array;
|
|
2347
|
+
/**
|
|
2348
|
+
* Creates a note carrying the provided attachments, using the metadata's
|
|
2349
|
+
* sender / note type / tag (attachments on the metadata itself are ignored).
|
|
2350
|
+
*
|
|
2351
|
+
* # Errors
|
|
2352
|
+
* Errors if the attachment set is invalid (too many attachments or words).
|
|
2353
|
+
*/
|
|
2354
|
+
static withAttachments(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient, attachments: NoteAttachment[]): Note;
|
|
2259
2355
|
}
|
|
2260
2356
|
|
|
2261
2357
|
export class NoteAndArgs {
|
|
@@ -2862,6 +2958,11 @@ export class NoteRecipient {
|
|
|
2862
2958
|
* Returns the digest of the recipient data (used in the note commitment).
|
|
2863
2959
|
*/
|
|
2864
2960
|
digest(): Word;
|
|
2961
|
+
/**
|
|
2962
|
+
* Creates a recipient from a script and storage, generating a fresh random
|
|
2963
|
+
* serial number (the secret that prevents double-spends).
|
|
2964
|
+
*/
|
|
2965
|
+
static fromScript(note_script: NoteScript, storage: NoteStorage): NoteRecipient;
|
|
2865
2966
|
/**
|
|
2866
2967
|
* Creates a note recipient from its serial number, script, and storage.
|
|
2867
2968
|
*/
|
|
@@ -3157,6 +3258,12 @@ export class OutputNoteRecord {
|
|
|
3157
3258
|
* Returns true if the note has been consumed on chain.
|
|
3158
3259
|
*/
|
|
3159
3260
|
isConsumed(): boolean;
|
|
3261
|
+
/**
|
|
3262
|
+
* Returns true while the note's on-chain inclusion is still unsettled
|
|
3263
|
+
* (`ExpectedFull` or `ExpectedPartial`), i.e. while sync is the mechanism
|
|
3264
|
+
* that can advance this record.
|
|
3265
|
+
*/
|
|
3266
|
+
isInclusionPending(): boolean;
|
|
3160
3267
|
/**
|
|
3161
3268
|
* Returns the note metadata.
|
|
3162
3269
|
*/
|
package/dist/st/docs-entry.d.ts
CHANGED
package/dist/st/eager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getWasmOrThrow } from './index.js';
|
|
2
2
|
export { AccountType, AuthScheme, CompilerResource, Linking, MidenArrays, MidenClient, MockWasmWebClient, MockWasmWebClient as MockWebClient, NoteVisibility, StorageMode, StorageResult, StorageView, WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote, withSyncLock, wordToBigInt } from './index.js';
|
|
3
|
-
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, EthAddress, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsSettingMutation, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkNoteStatusInfo, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PswapLineageRecord, PswapLineageState, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapEntryJs, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, sequentialSumBench, setupLogging } from './Cargo-
|
|
3
|
+
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, EthAddress, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsSettingMutation, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkAccountTarget, NetworkId, NetworkNoteStatusInfo, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PswapLineageRecord, PswapLineageState, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapEntryJs, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, sequentialSumBench, setupLogging } from './Cargo-Cysp4vto.js';
|
|
4
4
|
import './wasm.js';
|
|
5
5
|
|
|
6
6
|
// Eager entry point for @miden-sdk/miden-sdk (browser builds).
|
package/dist/st/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import loadWasm from './wasm.js';
|
|
2
|
-
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, EthAddress, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsSettingMutation, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkNoteStatusInfo, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PswapLineageRecord, PswapLineageState, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapEntryJs, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, sequentialSumBench, setupLogging } from './Cargo-
|
|
2
|
+
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, EthAddress, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsSettingMutation, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkAccountTarget, NetworkId, NetworkNoteStatusInfo, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PswapLineageRecord, PswapLineageState, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapEntryJs, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, sequentialSumBench, setupLogging } from './Cargo-Cysp4vto.js';
|
|
3
3
|
|
|
4
4
|
const WorkerAction = Object.freeze({
|
|
5
5
|
INIT: "init",
|
|
@@ -622,6 +622,97 @@ class TransactionsResource {
|
|
|
622
622
|
return { txId, note: null, result };
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Builds a Public custom-script note carrying a NetworkAccountTarget
|
|
627
|
+
* attachment, submits it as an own output note, and optionally waits for
|
|
628
|
+
* confirmation. Provide exactly one of `recipient` or `script`.
|
|
629
|
+
*/
|
|
630
|
+
async createNetworkNote(opts) {
|
|
631
|
+
this.#client.assertNotTerminated();
|
|
632
|
+
const wasm = await this.#getWasm();
|
|
633
|
+
|
|
634
|
+
if (opts.recipient && opts.script) {
|
|
635
|
+
throw new Error(
|
|
636
|
+
"createNetworkNote requires exactly one of `recipient` or `script`, not both."
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const senderId = resolveAccountRef(opts.account, wasm);
|
|
641
|
+
|
|
642
|
+
const target =
|
|
643
|
+
opts.target instanceof wasm.NetworkAccountTarget
|
|
644
|
+
? opts.target
|
|
645
|
+
: new wasm.NetworkAccountTarget(
|
|
646
|
+
resolveAccountRef(opts.target, wasm),
|
|
647
|
+
opts.executionHint
|
|
648
|
+
);
|
|
649
|
+
|
|
650
|
+
const noteAssets = opts.assets
|
|
651
|
+
? new wasm.NoteAssets(
|
|
652
|
+
(Array.isArray(opts.assets) ? opts.assets : [opts.assets]).map(
|
|
653
|
+
(a) =>
|
|
654
|
+
new wasm.FungibleAsset(
|
|
655
|
+
resolveAccountRef(a.token, wasm),
|
|
656
|
+
BigInt(a.amount)
|
|
657
|
+
)
|
|
658
|
+
)
|
|
659
|
+
)
|
|
660
|
+
: new wasm.NoteAssets();
|
|
661
|
+
|
|
662
|
+
const metadata = new wasm.NoteMetadata(
|
|
663
|
+
senderId,
|
|
664
|
+
wasm.NoteType.Public,
|
|
665
|
+
wasm.NoteTag.withAccountTarget(target.targetId())
|
|
666
|
+
);
|
|
667
|
+
|
|
668
|
+
let recipient = opts.recipient;
|
|
669
|
+
if (!recipient) {
|
|
670
|
+
if (!opts.script) {
|
|
671
|
+
throw new Error(
|
|
672
|
+
"createNetworkNote requires either `recipient` or `script`."
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
const storage = new wasm.NoteStorage(
|
|
676
|
+
new wasm.FeltArray(
|
|
677
|
+
(opts.inputs ?? []).map((value) => new wasm.Felt(value))
|
|
678
|
+
)
|
|
679
|
+
);
|
|
680
|
+
recipient = wasm.NoteRecipient.fromScript(opts.script, storage);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const attachments = [target.toAttachment()];
|
|
684
|
+
if (opts.attachment) {
|
|
685
|
+
attachments.push(new wasm.NoteAttachment(opts.attachment));
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
const note = wasm.Note.withAttachments(
|
|
689
|
+
noteAssets,
|
|
690
|
+
metadata,
|
|
691
|
+
recipient,
|
|
692
|
+
attachments
|
|
693
|
+
);
|
|
694
|
+
|
|
695
|
+
// NoteArray constructor consumes its elements; use push(¬e) to keep
|
|
696
|
+
// `note` valid so we can return it to the caller.
|
|
697
|
+
const ownOutputs = new wasm.NoteArray();
|
|
698
|
+
ownOutputs.push(note);
|
|
699
|
+
const request = new wasm.TransactionRequestBuilder()
|
|
700
|
+
.withOwnOutputNotes(ownOutputs)
|
|
701
|
+
.build();
|
|
702
|
+
|
|
703
|
+
const { txId, result } = await this.#submitOrSubmitWithProver(
|
|
704
|
+
senderId,
|
|
705
|
+
request,
|
|
706
|
+
opts.prover
|
|
707
|
+
);
|
|
708
|
+
|
|
709
|
+
if (opts.waitForConfirmation) {
|
|
710
|
+
await this.waitFor(txId.toHex(), { timeout: opts.timeout });
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
return { txId, note, result };
|
|
714
|
+
}
|
|
715
|
+
|
|
625
716
|
async mint(opts) {
|
|
626
717
|
this.#client.assertNotTerminated();
|
|
627
718
|
const wasm = await this.#getWasm();
|