@miden-sdk/miden-sdk 0.15.0-alpha.7 → 0.15.0
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-C9UbiAcT.js → Cargo-1zqmsGGR.js} +314 -96
- package/dist/mt/Cargo-1zqmsGGR.js.map +1 -0
- package/dist/mt/api-types.d.ts +17 -24
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +42 -19
- package/dist/mt/eager.js +1 -1
- package/dist/mt/index.js +8 -60
- 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-C9UbiAcT-Z344cyB1.js → Cargo-1zqmsGGR-COfl7R3D.js} +314 -96
- package/dist/mt/workers/Cargo-1zqmsGGR-COfl7R3D.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +315 -96
- 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-OZMlHpic.js → Cargo-qHCIdWdN.js} +315 -98
- package/dist/st/Cargo-qHCIdWdN.js.map +1 -0
- package/dist/st/api-types.d.ts +17 -24
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +42 -19
- package/dist/st/eager.js +1 -1
- package/dist/st/index.js +8 -60
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-OZMlHpic-DZjvJlWc.js → Cargo-qHCIdWdN-CZmgHdJc.js} +315 -98
- package/dist/st/workers/Cargo-qHCIdWdN-CZmgHdJc.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +316 -98
- 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/napi-compat.js +2 -2
- package/js/node-index.js +1 -4
- package/js/resources/accounts.js +2 -14
- package/js/utils.js +2 -31
- package/package.json +4 -4
- package/dist/mt/Cargo-C9UbiAcT.js.map +0 -1
- package/dist/mt/workers/Cargo-C9UbiAcT-Z344cyB1.js.map +0 -1
- package/dist/st/Cargo-OZMlHpic.js.map +0 -1
- package/dist/st/workers/Cargo-OZMlHpic-DZjvJlWc.js.map +0 -1
package/dist/mt/api-types.d.ts
CHANGED
|
@@ -135,26 +135,21 @@ export type Linking = "dynamic" | "static";
|
|
|
135
135
|
export type AccountType = (typeof AccountType)[keyof typeof AccountType];
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
138
|
+
* Faucet-kind selectors for `accounts.create({ type })`.
|
|
139
|
+
*
|
|
140
|
+
* These are NOT the low-level WASM `AccountType` enum. As of protocol 0.15 that
|
|
141
|
+
* enum encodes only account visibility (`Private` / `Public`), which the
|
|
142
|
+
* low-level builder sets via `AccountBuilder.storageMode()`. Wallets and
|
|
143
|
+
* contracts are not selected by a `type` value: a wallet is the default, and a
|
|
144
|
+
* contract is any `accounts.create()` call that passes `components`.
|
|
142
145
|
*/
|
|
143
146
|
export declare const AccountType: {
|
|
144
|
-
// WASM-compatible values
|
|
145
147
|
readonly FungibleFaucet: 0;
|
|
146
148
|
readonly NonFungibleFaucet: 1;
|
|
147
|
-
readonly RegularAccountImmutableCode: 2;
|
|
148
|
-
readonly RegularAccountUpdatableCode: 3;
|
|
149
|
-
// SDK-friendly aliases
|
|
150
|
-
readonly MutableWallet: 3;
|
|
151
|
-
readonly ImmutableWallet: 2;
|
|
152
|
-
readonly ImmutableContract: 2;
|
|
153
|
-
readonly MutableContract: 3;
|
|
154
149
|
};
|
|
155
150
|
|
|
156
151
|
/** Union of valid AccountType numeric values. */
|
|
157
|
-
export type AccountTypeValue = 0 | 1
|
|
152
|
+
export type AccountTypeValue = 0 | 1;
|
|
158
153
|
|
|
159
154
|
// ════════════════════════════════════════════════════════════════
|
|
160
155
|
// Client options
|
|
@@ -243,15 +238,16 @@ export type NoteInput = string | NoteId | Note | InputNoteRecord;
|
|
|
243
238
|
// Account types
|
|
244
239
|
// ════════════════════════════════════════════════════════════════
|
|
245
240
|
|
|
246
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Create a wallet, faucet, or contract. A faucet sets `type`, a contract
|
|
243
|
+
* passes `components`, and a wallet is the default (neither).
|
|
244
|
+
*/
|
|
247
245
|
export type CreateAccountOptions =
|
|
248
246
|
| WalletCreateOptions
|
|
249
247
|
| FaucetCreateOptions
|
|
250
248
|
| ContractCreateOptions;
|
|
251
249
|
|
|
252
250
|
export interface WalletCreateOptions {
|
|
253
|
-
/** Account type. Defaults to `AccountType.MutableWallet`. */
|
|
254
|
-
type?: AccountTypeValue;
|
|
255
251
|
storage?: StorageMode;
|
|
256
252
|
auth?: AuthSchemeType;
|
|
257
253
|
seed?: string | Uint8Array;
|
|
@@ -270,8 +266,6 @@ export interface FaucetCreateOptions {
|
|
|
270
266
|
}
|
|
271
267
|
|
|
272
268
|
export interface ContractCreateOptions {
|
|
273
|
-
/** Use `AccountType.ImmutableContract` or `AccountType.MutableContract`. */
|
|
274
|
-
type?: AccountTypeValue;
|
|
275
269
|
/** Raw 32-byte seed (Uint8Array). Required. */
|
|
276
270
|
seed: Uint8Array;
|
|
277
271
|
/** Auth secret key. Required. */
|
|
@@ -295,15 +289,13 @@ export interface AccountDetails {
|
|
|
295
289
|
*
|
|
296
290
|
* - `AccountRef` (string, AccountId, Account, AccountHeader) — Import a public account by ID (fetches state from the network).
|
|
297
291
|
* - `{ file: AccountFile }` — Import from a previously exported account file (works for both public and private accounts).
|
|
298
|
-
* - `{ seed,
|
|
292
|
+
* - `{ seed, auth? }` — Reconstruct a **public** account from its init seed. **Does not work for private accounts** — use the account file workflow instead.
|
|
299
293
|
*/
|
|
300
294
|
export type ImportAccountInput =
|
|
301
295
|
| AccountRef
|
|
302
296
|
| { file: AccountFile }
|
|
303
297
|
| {
|
|
304
298
|
seed: Uint8Array;
|
|
305
|
-
/** Account type. Defaults to `AccountType.MutableWallet`. */
|
|
306
|
-
type?: AccountTypeValue;
|
|
307
299
|
auth?: AuthSchemeType;
|
|
308
300
|
};
|
|
309
301
|
|
|
@@ -627,10 +619,11 @@ export interface BuildSwapTagOptions {
|
|
|
627
619
|
|
|
628
620
|
export interface AccountsResource {
|
|
629
621
|
/**
|
|
630
|
-
* Create a new wallet, faucet, or contract account. Defaults to a
|
|
631
|
-
*
|
|
622
|
+
* Create a new wallet, faucet, or contract account. Defaults to a wallet
|
|
623
|
+
* if no options are provided.
|
|
632
624
|
*
|
|
633
|
-
* @param options - Account creation options
|
|
625
|
+
* @param options - Account creation options. A faucet sets `type`, a
|
|
626
|
+
* contract passes `components`, and a wallet is the default.
|
|
634
627
|
*/
|
|
635
628
|
create(options?: CreateAccountOptions): Promise<Account>;
|
|
636
629
|
/**
|
|
Binary file
|
|
@@ -120,7 +120,8 @@ export class AccountBuilder {
|
|
|
120
120
|
free(): void;
|
|
121
121
|
[Symbol.dispose](): void;
|
|
122
122
|
/**
|
|
123
|
-
* Sets the account type
|
|
123
|
+
* Sets the account type, which in protocol 0.15 is the account visibility
|
|
124
|
+
* (public or private). Equivalent to [`Self::storage_mode`].
|
|
124
125
|
*/
|
|
125
126
|
accountType(account_type: AccountType): AccountBuilder;
|
|
126
127
|
/**
|
|
@@ -900,16 +901,8 @@ export class AssetVault {
|
|
|
900
901
|
/**
|
|
901
902
|
* Returns the balance for the given fungible faucet, or zero if absent.
|
|
902
903
|
*
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
* reads don't run asset callbacks. Returns zero on lookup error (`Err` arms here would
|
|
906
|
-
* indicate the key was constructed wrong, which can't happen for fungible keys built
|
|
907
|
-
* this way).
|
|
908
|
-
*
|
|
909
|
-
* NOTE: the `AssetVaultKey` encodes the callback flag, so this reports only the balance
|
|
910
|
-
* of callback-*disabled* fungible assets. Faucets built by this SDK omit transfer policies
|
|
911
|
-
* and therefore mint callback-disabled assets, so this is exact for them; an asset minted
|
|
912
|
-
* elsewhere with callbacks enabled would not be counted here.
|
|
904
|
+
* Matches by faucet id across the vault's fungible assets, so the balance is
|
|
905
|
+
* found regardless of the asset's callback flag.
|
|
913
906
|
*/
|
|
914
907
|
getBalance(faucet_id: AccountId): bigint;
|
|
915
908
|
/**
|
|
@@ -1531,9 +1524,8 @@ export class FungibleAssetDelta {
|
|
|
1531
1524
|
/**
|
|
1532
1525
|
* Returns the delta amount for a given faucet, if present.
|
|
1533
1526
|
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1536
|
-
* asset callbacks. `new_fungible` on the 0.15 surface is infallible.
|
|
1527
|
+
* Matches by faucet id so the delta is found regardless of the asset's
|
|
1528
|
+
* callback flag.
|
|
1537
1529
|
*/
|
|
1538
1530
|
amount(faucet_id: AccountId): bigint | undefined;
|
|
1539
1531
|
/**
|
|
@@ -1869,6 +1861,33 @@ export class JsAccountUpdate {
|
|
|
1869
1861
|
vaultRoot: string;
|
|
1870
1862
|
}
|
|
1871
1863
|
|
|
1864
|
+
/**
|
|
1865
|
+
* JS-facing form of a [`miden_client::store::SettingMutation`], applied as a
|
|
1866
|
+
* single atomic batch by the `applySettingsMutations` function in
|
|
1867
|
+
* `settings.js`.
|
|
1868
|
+
*/
|
|
1869
|
+
export class JsSettingMutation {
|
|
1870
|
+
private constructor();
|
|
1871
|
+
free(): void;
|
|
1872
|
+
[Symbol.dispose](): void;
|
|
1873
|
+
/**
|
|
1874
|
+
* The `settings` key the mutation targets.
|
|
1875
|
+
*/
|
|
1876
|
+
key: string;
|
|
1877
|
+
/**
|
|
1878
|
+
* Either `"set"` or `"remove"`.
|
|
1879
|
+
*/
|
|
1880
|
+
kind: string;
|
|
1881
|
+
/**
|
|
1882
|
+
* The value to write. `Some` for `"set"`, `None` for `"remove"`.
|
|
1883
|
+
*/
|
|
1884
|
+
get value(): Uint8Array | undefined;
|
|
1885
|
+
/**
|
|
1886
|
+
* The value to write. `Some` for `"set"`, `None` for `"remove"`.
|
|
1887
|
+
*/
|
|
1888
|
+
set value(value: Uint8Array | null | undefined);
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1872
1891
|
/**
|
|
1873
1892
|
* An object that contains data for a sync update,
|
|
1874
1893
|
* which will be received by the applyStateSync JS function.
|
|
@@ -2972,7 +2991,7 @@ export enum NoteType {
|
|
|
2972
2991
|
/**
|
|
2973
2992
|
* Notes with this type have only their hash published to the network.
|
|
2974
2993
|
*/
|
|
2975
|
-
Private =
|
|
2994
|
+
Private = 0,
|
|
2976
2995
|
/**
|
|
2977
2996
|
* Notes with this type are fully shared with the network.
|
|
2978
2997
|
*/
|
|
@@ -3379,7 +3398,9 @@ export class RpcClient {
|
|
|
3379
3398
|
* the full storage map data with pagination support.
|
|
3380
3399
|
*
|
|
3381
3400
|
* @param `block_from` - The starting block number.
|
|
3382
|
-
* @param `block_to` - Optional ending block number. When `undefined`,
|
|
3401
|
+
* @param `block_to` - Optional ending block number. When `undefined`, the current chain tip
|
|
3402
|
+
* is fetched with an extra RPC call and used as the bound (the node rejects values greater
|
|
3403
|
+
* than the tip).
|
|
3383
3404
|
* @param `account_id` - The account to sync storage maps for.
|
|
3384
3405
|
*/
|
|
3385
3406
|
syncStorageMaps(block_from: number, block_to: number | null | undefined, account_id: AccountId): Promise<StorageMapInfo>;
|
|
@@ -3417,7 +3438,8 @@ export class SerializedInputNoteData {
|
|
|
3417
3438
|
set noteId(value: string | null | undefined);
|
|
3418
3439
|
noteScriptRoot: string;
|
|
3419
3440
|
noteScript: Uint8Array;
|
|
3420
|
-
nullifier: string;
|
|
3441
|
+
get nullifier(): string | undefined;
|
|
3442
|
+
set nullifier(value: string | null | undefined);
|
|
3421
3443
|
serialNumber: Uint8Array;
|
|
3422
3444
|
stateDiscriminant: number;
|
|
3423
3445
|
state: Uint8Array;
|
|
@@ -3428,6 +3450,7 @@ export class SerializedOutputNoteData {
|
|
|
3428
3450
|
free(): void;
|
|
3429
3451
|
[Symbol.dispose](): void;
|
|
3430
3452
|
attachments: Uint8Array;
|
|
3453
|
+
detailsCommitment: string;
|
|
3431
3454
|
expectedHeight: number;
|
|
3432
3455
|
metadata: Uint8Array;
|
|
3433
3456
|
noteAssets: Uint8Array;
|
|
@@ -4503,7 +4526,7 @@ export class WebClient {
|
|
|
4503
4526
|
* from the note file when one is available.
|
|
4504
4527
|
*/
|
|
4505
4528
|
importNoteFile(note_file: NoteFile): Promise<string>;
|
|
4506
|
-
importPublicAccountFromSeed(init_seed: Uint8Array,
|
|
4529
|
+
importPublicAccountFromSeed(init_seed: Uint8Array, auth_scheme: AuthScheme): Promise<Account>;
|
|
4507
4530
|
insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
|
|
4508
4531
|
/**
|
|
4509
4532
|
* Returns the raw JS value that the most recent sign-callback invocation
|
|
@@ -4559,7 +4582,7 @@ export class WebClient {
|
|
|
4559
4582
|
newPswapCreateTransactionRequest(creator_account_id: AccountId, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint, note_type: NoteType, payback_note_type: NoteType): Promise<TransactionRequest>;
|
|
4560
4583
|
newSendTransactionRequest(sender_account_id: AccountId, target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint, recall_height?: number | null, timelock_height?: number | null): Promise<TransactionRequest>;
|
|
4561
4584
|
newSwapTransactionRequest(sender_account_id: AccountId, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint, note_type: NoteType, payback_note_type: NoteType): Promise<TransactionRequest>;
|
|
4562
|
-
newWallet(storage_mode: AccountStorageMode,
|
|
4585
|
+
newWallet(storage_mode: AccountStorageMode, auth_scheme: AuthScheme, init_seed?: Uint8Array | null): Promise<Account>;
|
|
4563
4586
|
proveBlock(): Promise<void>;
|
|
4564
4587
|
/**
|
|
4565
4588
|
* Generates a transaction proof using either the provided prover or the client's default
|
package/dist/mt/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, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, 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, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } 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, 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, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-1zqmsGGR.js';
|
|
4
4
|
import './wasm.js';
|
|
5
5
|
|
|
6
6
|
// Eager entry point for @miden-sdk/miden-sdk (browser builds).
|
package/dist/mt/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, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, 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, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } 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, 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, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-1zqmsGGR.js';
|
|
3
3
|
|
|
4
4
|
const WorkerAction = Object.freeze({
|
|
5
5
|
INIT: "init",
|
|
@@ -224,7 +224,7 @@ function resolveNoteType(type, wasm) {
|
|
|
224
224
|
/**
|
|
225
225
|
* Resolves a storage mode string to a WASM AccountStorageMode instance.
|
|
226
226
|
*
|
|
227
|
-
* @param {string | undefined} mode - "private"
|
|
227
|
+
* @param {string | undefined} mode - "private" or "public". Defaults to "private".
|
|
228
228
|
* @param {object} wasm - The WASM module.
|
|
229
229
|
* @returns {AccountStorageMode} The storage mode instance.
|
|
230
230
|
*/
|
|
@@ -232,15 +232,13 @@ function resolveStorageMode(mode, wasm) {
|
|
|
232
232
|
switch (mode) {
|
|
233
233
|
case "public":
|
|
234
234
|
return wasm.AccountStorageMode.public();
|
|
235
|
-
case "network":
|
|
236
|
-
return wasm.AccountStorageMode.network();
|
|
237
235
|
case "private":
|
|
238
236
|
case undefined:
|
|
239
237
|
case null:
|
|
240
238
|
return wasm.AccountStorageMode.private();
|
|
241
239
|
default:
|
|
242
240
|
throw new Error(
|
|
243
|
-
`Unknown storage mode: "${mode}". Expected "private"
|
|
241
|
+
`Unknown storage mode: "${mode}". Expected "private" or "public".`
|
|
244
242
|
);
|
|
245
243
|
}
|
|
246
244
|
}
|
|
@@ -264,33 +262,6 @@ function resolveAuthScheme(scheme, wasm) {
|
|
|
264
262
|
);
|
|
265
263
|
}
|
|
266
264
|
|
|
267
|
-
/**
|
|
268
|
-
* Resolves an AccountType value to a boolean `mutable` flag
|
|
269
|
-
* for the underlying WASM `newWallet()` / `importPublicAccountFromSeed()` calls.
|
|
270
|
-
*
|
|
271
|
-
* Accepts the numeric WASM enum values (2 = immutable, 3 = mutable) or the
|
|
272
|
-
* legacy string aliases ("MutableWallet", "ImmutableWallet"). Defaults to
|
|
273
|
-
* mutable when undefined.
|
|
274
|
-
*
|
|
275
|
-
* @param {number | string | undefined} accountType
|
|
276
|
-
* @returns {boolean} Whether the account code is mutable.
|
|
277
|
-
*/
|
|
278
|
-
function resolveAccountMutability(accountType) {
|
|
279
|
-
if (
|
|
280
|
-
accountType == null ||
|
|
281
|
-
accountType === "MutableWallet" ||
|
|
282
|
-
accountType === 3
|
|
283
|
-
) {
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
if (accountType === "ImmutableWallet" || accountType === 2) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
throw new Error(
|
|
290
|
-
`Unknown wallet account type: "${accountType}". Expected AccountType.MutableWallet (3) or AccountType.ImmutableWallet (2).`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
265
|
/**
|
|
295
266
|
* Resolves a NoteInput (string | NoteId | InputNoteRecord | Note) to a hex string.
|
|
296
267
|
*
|
|
@@ -413,17 +384,11 @@ class AccountsResource {
|
|
|
413
384
|
) {
|
|
414
385
|
return await this.#createContract(opts, wasm);
|
|
415
386
|
} else {
|
|
416
|
-
// Default: wallet
|
|
417
|
-
const mutable = resolveAccountMutability(opts?.type);
|
|
387
|
+
// Default: wallet
|
|
418
388
|
const storageMode = resolveStorageMode(opts?.storage ?? "private", wasm);
|
|
419
389
|
const authScheme = resolveAuthScheme(opts?.auth, wasm);
|
|
420
390
|
const seed = opts?.seed ? await hashSeed(opts.seed) : undefined;
|
|
421
|
-
return await this.#inner.newWallet(
|
|
422
|
-
storageMode,
|
|
423
|
-
mutable,
|
|
424
|
-
authScheme,
|
|
425
|
-
seed
|
|
426
|
-
);
|
|
391
|
+
return await this.#inner.newWallet(storageMode, authScheme, seed);
|
|
427
392
|
}
|
|
428
393
|
}
|
|
429
394
|
|
|
@@ -433,9 +398,6 @@ class AccountsResource {
|
|
|
433
398
|
if (!opts.auth)
|
|
434
399
|
throw new Error("Contract creation requires an 'auth' (AuthSecretKey)");
|
|
435
400
|
|
|
436
|
-
// The 0.15 protocol has no code-mutability distinction, so the `type`
|
|
437
|
-
// ("ImmutableContract" / "MutableContract") only steers routing here; the
|
|
438
|
-
// account's on-chain visibility is set entirely by `storageMode`.
|
|
439
401
|
const storageMode = resolveStorageMode(opts.storage ?? "public", wasm);
|
|
440
402
|
const authComponent =
|
|
441
403
|
wasm.AccountComponent.createAuthComponentFromSecretKey(opts.auth);
|
|
@@ -549,10 +511,8 @@ class AccountsResource {
|
|
|
549
511
|
if (input.seed) {
|
|
550
512
|
// Import public account from seed
|
|
551
513
|
const authScheme = resolveAuthScheme(input.auth, wasm);
|
|
552
|
-
const mutable = resolveAccountMutability(input.type);
|
|
553
514
|
return await this.#inner.importPublicAccountFromSeed(
|
|
554
515
|
input.seed,
|
|
555
|
-
mutable,
|
|
556
516
|
authScheme
|
|
557
517
|
);
|
|
558
518
|
}
|
|
@@ -2508,16 +2468,9 @@ function installStorageView(wasmModule) {
|
|
|
2508
2468
|
}
|
|
2509
2469
|
|
|
2510
2470
|
const AccountType = Object.freeze({
|
|
2511
|
-
//
|
|
2471
|
+
// Faucet-kind selectors for accounts.create({ type }).
|
|
2512
2472
|
FungibleFaucet: 0,
|
|
2513
2473
|
NonFungibleFaucet: 1,
|
|
2514
|
-
RegularAccountImmutableCode: 2,
|
|
2515
|
-
RegularAccountUpdatableCode: 3,
|
|
2516
|
-
// SDK-friendly aliases (same numeric values as their WASM equivalents)
|
|
2517
|
-
MutableWallet: 3,
|
|
2518
|
-
ImmutableWallet: 2,
|
|
2519
|
-
ImmutableContract: 2,
|
|
2520
|
-
MutableContract: 3,
|
|
2521
2474
|
});
|
|
2522
2475
|
|
|
2523
2476
|
const AuthScheme = Object.freeze({
|
|
@@ -3222,15 +3175,10 @@ class WebClient {
|
|
|
3222
3175
|
|
|
3223
3176
|
// ----- Explicitly Wrapped Methods (Worker-Forwarded) -----
|
|
3224
3177
|
|
|
3225
|
-
async newWallet(storageMode,
|
|
3178
|
+
async newWallet(storageMode, authSchemeId, seed) {
|
|
3226
3179
|
return this._serializeWasmCall(async () => {
|
|
3227
3180
|
const wasmWebClient = await this.getWasmWebClient();
|
|
3228
|
-
return await wasmWebClient.newWallet(
|
|
3229
|
-
storageMode,
|
|
3230
|
-
mutable,
|
|
3231
|
-
authSchemeId,
|
|
3232
|
-
seed
|
|
3233
|
-
);
|
|
3181
|
+
return await wasmWebClient.newWallet(storageMode, authSchemeId, seed);
|
|
3234
3182
|
});
|
|
3235
3183
|
}
|
|
3236
3184
|
|