@miden-sdk/miden-sdk 0.15.4 → 0.15.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/README.md +16 -0
- package/dist/mt/{Cargo-DjVnfWKi.js → Cargo-C001gt8g.js} +237 -76
- package/dist/mt/Cargo-C001gt8g.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 +60 -0
- 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-C001gt8g-B8wBADUI.js} +237 -76
- package/dist/mt/workers/Cargo-C001gt8g-B8wBADUI.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +238 -76
- 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-CR1mzjgg.js} +235 -75
- package/dist/st/Cargo-CR1mzjgg.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 +60 -0
- 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-CR1mzjgg-DeDmKA4W.js} +235 -75
- package/dist/st/workers/Cargo-CR1mzjgg-DeDmKA4W.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +236 -75
- 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
|
|
@@ -2113,6 +2113,44 @@ export class MerklePath {
|
|
|
2113
2113
|
verify(index: bigint, node: Word, root: Word): boolean;
|
|
2114
2114
|
}
|
|
2115
2115
|
|
|
2116
|
+
/**
|
|
2117
|
+
* Targets a note at a public network account so the operator auto-consumes it.
|
|
2118
|
+
*
|
|
2119
|
+
* A note is a network note when it is `Public` and carries a valid
|
|
2120
|
+
* `NetworkAccountTarget` attachment (see `Note.isNetworkNote`).
|
|
2121
|
+
*/
|
|
2122
|
+
export class NetworkAccountTarget {
|
|
2123
|
+
free(): void;
|
|
2124
|
+
[Symbol.dispose](): void;
|
|
2125
|
+
/**
|
|
2126
|
+
* Returns the note execution hint.
|
|
2127
|
+
*/
|
|
2128
|
+
executionHint(): NoteExecutionHint;
|
|
2129
|
+
/**
|
|
2130
|
+
* Decodes a `NoteAttachment` back into a `NetworkAccountTarget`.
|
|
2131
|
+
*
|
|
2132
|
+
* # Errors
|
|
2133
|
+
* Errors if the attachment is not a valid network-account-target attachment.
|
|
2134
|
+
*/
|
|
2135
|
+
static fromAttachment(attachment: NoteAttachment): NetworkAccountTarget;
|
|
2136
|
+
/**
|
|
2137
|
+
* Creates a target for the given network account. `executionHint` defaults
|
|
2138
|
+
* to `NoteExecutionHint.always()`.
|
|
2139
|
+
*
|
|
2140
|
+
* # Errors
|
|
2141
|
+
* Errors if `account_id` is not a public account.
|
|
2142
|
+
*/
|
|
2143
|
+
constructor(account_id: AccountId, execution_hint?: NoteExecutionHint | null);
|
|
2144
|
+
/**
|
|
2145
|
+
* Returns the targeted network account id.
|
|
2146
|
+
*/
|
|
2147
|
+
targetId(): AccountId;
|
|
2148
|
+
/**
|
|
2149
|
+
* Encodes this target as a `NoteAttachment`.
|
|
2150
|
+
*/
|
|
2151
|
+
toAttachment(): NoteAttachment;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2116
2154
|
/**
|
|
2117
2155
|
* The identifier of a Miden network.
|
|
2118
2156
|
*/
|
|
@@ -2193,6 +2231,10 @@ export class Note {
|
|
|
2193
2231
|
* Returns the assets locked inside the note.
|
|
2194
2232
|
*/
|
|
2195
2233
|
assets(): NoteAssets;
|
|
2234
|
+
/**
|
|
2235
|
+
* Returns the note's attachments.
|
|
2236
|
+
*/
|
|
2237
|
+
attachments(): NoteAttachment[];
|
|
2196
2238
|
/**
|
|
2197
2239
|
* Returns the commitment to the note (its ID).
|
|
2198
2240
|
*
|
|
@@ -2228,6 +2270,11 @@ export class Note {
|
|
|
2228
2270
|
* Returns the unique identifier of the note.
|
|
2229
2271
|
*/
|
|
2230
2272
|
id(): NoteId;
|
|
2273
|
+
/**
|
|
2274
|
+
* Returns true if the note is a network note (public + a valid
|
|
2275
|
+
* `NetworkAccountTarget` attachment).
|
|
2276
|
+
*/
|
|
2277
|
+
isNetworkNote(): boolean;
|
|
2231
2278
|
/**
|
|
2232
2279
|
* Returns the public metadata associated with the note.
|
|
2233
2280
|
*/
|
|
@@ -2256,6 +2303,14 @@ export class Note {
|
|
|
2256
2303
|
* Serializes the note into bytes.
|
|
2257
2304
|
*/
|
|
2258
2305
|
serialize(): Uint8Array;
|
|
2306
|
+
/**
|
|
2307
|
+
* Creates a note carrying the provided attachments, using the metadata's
|
|
2308
|
+
* sender / note type / tag (attachments on the metadata itself are ignored).
|
|
2309
|
+
*
|
|
2310
|
+
* # Errors
|
|
2311
|
+
* Errors if the attachment set is invalid (too many attachments or words).
|
|
2312
|
+
*/
|
|
2313
|
+
static withAttachments(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient, attachments: NoteAttachment[]): Note;
|
|
2259
2314
|
}
|
|
2260
2315
|
|
|
2261
2316
|
export class NoteAndArgs {
|
|
@@ -2862,6 +2917,11 @@ export class NoteRecipient {
|
|
|
2862
2917
|
* Returns the digest of the recipient data (used in the note commitment).
|
|
2863
2918
|
*/
|
|
2864
2919
|
digest(): Word;
|
|
2920
|
+
/**
|
|
2921
|
+
* Creates a recipient from a script and storage, generating a fresh random
|
|
2922
|
+
* serial number (the secret that prevents double-spends).
|
|
2923
|
+
*/
|
|
2924
|
+
static fromScript(note_script: NoteScript, storage: NoteStorage): NoteRecipient;
|
|
2865
2925
|
/**
|
|
2866
2926
|
* Creates a note recipient from its serial number, script, and storage.
|
|
2867
2927
|
*/
|
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-CR1mzjgg.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-CR1mzjgg.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();
|