@miden-sdk/miden-sdk 0.14.4 → 0.14.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.
@@ -84,9 +84,25 @@ export declare const AuthScheme: {
84
84
  };
85
85
 
86
86
  /**
87
- * Union of all values in the AuthScheme const.
87
+ * Union of all string values in the AuthScheme const. Merges with the
88
+ * `AuthScheme` value so `authScheme?: AuthScheme` resolves to
89
+ * `"falcon" | "ecdsa"` in type position while `AuthScheme.Falcon` /
90
+ * `AuthScheme.ECDSA` still work in value position.
88
91
  */
89
- export type AuthSchemeType = (typeof AuthScheme)[keyof typeof AuthScheme];
92
+ export type AuthScheme = (typeof AuthScheme)[keyof typeof AuthScheme];
93
+
94
+ /** @deprecated Alias for `AuthScheme` (the string union). */
95
+ export type AuthSchemeType = AuthScheme;
96
+
97
+ /**
98
+ * Resolves an `AuthScheme` string to the numeric value expected by low-level
99
+ * wasm-bindgen methods such as
100
+ * `AccountComponent.createAuthComponentFromCommitment(commitment, scheme)`.
101
+ *
102
+ * @param scheme - `AuthScheme.Falcon` or `AuthScheme.ECDSA`. Defaults to `"falcon"`.
103
+ * @returns The numeric AuthScheme enum value.
104
+ */
105
+ export declare function resolveAuthScheme(scheme?: AuthScheme): number;
90
106
 
91
107
  /**
92
108
  * User-friendly note visibility constants.
Binary file
@@ -121,6 +121,14 @@ export class AccountArray {
121
121
  length(): number;
122
122
  constructor(elements?: Account[] | null);
123
123
  push(element: Account): void;
124
+ /**
125
+ * Replace the element at `index`. Borrows + clones the input
126
+ * (mirrors `push`), so the caller's JS handle remains valid
127
+ * after the call. Without this borrow, passing `elem` by
128
+ * value would move the underlying Rust value out of the
129
+ * caller's JS handle and any subsequent method on it would
130
+ * panic with `"null pointer passed to rust"`.
131
+ */
124
132
  replaceAt(index: number, elem: Account): void;
125
133
  }
126
134
 
@@ -445,6 +453,14 @@ export class AccountIdArray {
445
453
  length(): number;
446
454
  constructor(elements?: AccountId[] | null);
447
455
  push(element: AccountId): void;
456
+ /**
457
+ * Replace the element at `index`. Borrows + clones the input
458
+ * (mirrors `push`), so the caller's JS handle remains valid
459
+ * after the call. Without this borrow, passing `elem` by
460
+ * value would move the underlying Rust value out of the
461
+ * caller's JS handle and any subsequent method on it would
462
+ * panic with `"null pointer passed to rust"`.
463
+ */
448
464
  replaceAt(index: number, elem: AccountId): void;
449
465
  }
450
466
 
@@ -1322,6 +1338,14 @@ export class FeltArray {
1322
1338
  length(): number;
1323
1339
  constructor(elements?: Felt[] | null);
1324
1340
  push(element: Felt): void;
1341
+ /**
1342
+ * Replace the element at `index`. Borrows + clones the input
1343
+ * (mirrors `push`), so the caller's JS handle remains valid
1344
+ * after the call. Without this borrow, passing `elem` by
1345
+ * value would move the underlying Rust value out of the
1346
+ * caller's JS handle and any subsequent method on it would
1347
+ * panic with `"null pointer passed to rust"`.
1348
+ */
1325
1349
  replaceAt(index: number, elem: Felt): void;
1326
1350
  }
1327
1351
 
@@ -1462,6 +1486,14 @@ export class ForeignAccountArray {
1462
1486
  length(): number;
1463
1487
  constructor(elements?: ForeignAccount[] | null);
1464
1488
  push(element: ForeignAccount): void;
1489
+ /**
1490
+ * Replace the element at `index`. Borrows + clones the input
1491
+ * (mirrors `push`), so the caller's JS handle remains valid
1492
+ * after the call. Without this borrow, passing `elem` by
1493
+ * value would move the underlying Rust value out of the
1494
+ * caller's JS handle and any subsequent method on it would
1495
+ * panic with `"null pointer passed to rust"`.
1496
+ */
1465
1497
  replaceAt(index: number, elem: ForeignAccount): void;
1466
1498
  }
1467
1499
 
@@ -2112,6 +2144,14 @@ export class NoteAndArgsArray {
2112
2144
  length(): number;
2113
2145
  constructor(elements?: NoteAndArgs[] | null);
2114
2146
  push(element: NoteAndArgs): void;
2147
+ /**
2148
+ * Replace the element at `index`. Borrows + clones the input
2149
+ * (mirrors `push`), so the caller's JS handle remains valid
2150
+ * after the call. Without this borrow, passing `elem` by
2151
+ * value would move the underlying Rust value out of the
2152
+ * caller's JS handle and any subsequent method on it would
2153
+ * panic with `"null pointer passed to rust"`.
2154
+ */
2115
2155
  replaceAt(index: number, elem: NoteAndArgs): void;
2116
2156
  }
2117
2157
 
@@ -2133,6 +2173,14 @@ export class NoteArray {
2133
2173
  length(): number;
2134
2174
  constructor(elements?: Note[] | null);
2135
2175
  push(element: Note): void;
2176
+ /**
2177
+ * Replace the element at `index`. Borrows + clones the input
2178
+ * (mirrors `push`), so the caller's JS handle remains valid
2179
+ * after the call. Without this borrow, passing `elem` by
2180
+ * value would move the underlying Rust value out of the
2181
+ * caller's JS handle and any subsequent method on it would
2182
+ * panic with `"null pointer passed to rust"`.
2183
+ */
2136
2184
  replaceAt(index: number, elem: Note): void;
2137
2185
  }
2138
2186
 
@@ -2371,6 +2419,14 @@ export class NoteDetailsAndTagArray {
2371
2419
  length(): number;
2372
2420
  constructor(elements?: NoteDetailsAndTag[] | null);
2373
2421
  push(element: NoteDetailsAndTag): void;
2422
+ /**
2423
+ * Replace the element at `index`. Borrows + clones the input
2424
+ * (mirrors `push`), so the caller's JS handle remains valid
2425
+ * after the call. Without this borrow, passing `elem` by
2426
+ * value would move the underlying Rust value out of the
2427
+ * caller's JS handle and any subsequent method on it would
2428
+ * panic with `"null pointer passed to rust"`.
2429
+ */
2374
2430
  replaceAt(index: number, elem: NoteDetailsAndTag): void;
2375
2431
  }
2376
2432
 
@@ -2597,6 +2653,14 @@ export class NoteIdAndArgsArray {
2597
2653
  length(): number;
2598
2654
  constructor(elements?: NoteIdAndArgs[] | null);
2599
2655
  push(element: NoteIdAndArgs): void;
2656
+ /**
2657
+ * Replace the element at `index`. Borrows + clones the input
2658
+ * (mirrors `push`), so the caller's JS handle remains valid
2659
+ * after the call. Without this borrow, passing `elem` by
2660
+ * value would move the underlying Rust value out of the
2661
+ * caller's JS handle and any subsequent method on it would
2662
+ * panic with `"null pointer passed to rust"`.
2663
+ */
2600
2664
  replaceAt(index: number, elem: NoteIdAndArgs): void;
2601
2665
  }
2602
2666
 
@@ -2731,6 +2795,14 @@ export class NoteRecipientArray {
2731
2795
  length(): number;
2732
2796
  constructor(elements?: NoteRecipient[] | null);
2733
2797
  push(element: NoteRecipient): void;
2798
+ /**
2799
+ * Replace the element at `index`. Borrows + clones the input
2800
+ * (mirrors `push`), so the caller's JS handle remains valid
2801
+ * after the call. Without this borrow, passing `elem` by
2802
+ * value would move the underlying Rust value out of the
2803
+ * caller's JS handle and any subsequent method on it would
2804
+ * panic with `"null pointer passed to rust"`.
2805
+ */
2734
2806
  replaceAt(index: number, elem: NoteRecipient): void;
2735
2807
  }
2736
2808
 
@@ -2952,6 +3024,14 @@ export class OutputNoteArray {
2952
3024
  length(): number;
2953
3025
  constructor(elements?: OutputNote[] | null);
2954
3026
  push(element: OutputNote): void;
3027
+ /**
3028
+ * Replace the element at `index`. Borrows + clones the input
3029
+ * (mirrors `push`), so the caller's JS handle remains valid
3030
+ * after the call. Without this borrow, passing `elem` by
3031
+ * value would move the underlying Rust value out of the
3032
+ * caller's JS handle and any subsequent method on it would
3033
+ * panic with `"null pointer passed to rust"`.
3034
+ */
2955
3035
  replaceAt(index: number, elem: OutputNote): void;
2956
3036
  }
2957
3037
 
@@ -3618,6 +3698,14 @@ export class StorageSlotArray {
3618
3698
  length(): number;
3619
3699
  constructor(elements?: StorageSlot[] | null);
3620
3700
  push(element: StorageSlot): void;
3701
+ /**
3702
+ * Replace the element at `index`. Borrows + clones the input
3703
+ * (mirrors `push`), so the caller's JS handle remains valid
3704
+ * after the call. Without this borrow, passing `elem` by
3705
+ * value would move the underlying Rust value out of the
3706
+ * caller's JS handle and any subsequent method on it would
3707
+ * panic with `"null pointer passed to rust"`.
3708
+ */
3621
3709
  replaceAt(index: number, elem: StorageSlot): void;
3622
3710
  }
3623
3711
 
@@ -4065,6 +4153,14 @@ export class TransactionScriptInputPairArray {
4065
4153
  length(): number;
4066
4154
  constructor(elements?: TransactionScriptInputPair[] | null);
4067
4155
  push(element: TransactionScriptInputPair): void;
4156
+ /**
4157
+ * Replace the element at `index`. Borrows + clones the input
4158
+ * (mirrors `push`), so the caller's JS handle remains valid
4159
+ * after the call. Without this borrow, passing `elem` by
4160
+ * value would move the underlying Rust value out of the
4161
+ * caller's JS handle and any subsequent method on it would
4162
+ * panic with `"null pointer passed to rust"`.
4163
+ */
4068
4164
  replaceAt(index: number, elem: TransactionScriptInputPair): void;
4069
4165
  }
4070
4166
 
package/dist/eager.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getWasmOrThrow } from './index.js';
2
- export { AccountType, AuthScheme, CompilerResource, Linking, MidenArrays, MidenClient, MockWasmWebClient, NoteVisibility, StorageMode, WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote } 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, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentKind, 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, 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, setupLogging } from './Cargo-Bwjf7IkR.js';
2
+ export { AccountArray, AccountIdArray, AccountType, AuthScheme, CompilerResource, FeltArray, ForeignAccountArray, Linking, MidenArrays, MidenClient, MockWasmWebClient, NoteAndArgsArray, NoteArray, NoteIdAndArgsArray, NoteRecipientArray, NoteVisibility, OutputNoteArray, StorageMode, StorageSlotArray, TransactionScriptInputPairArray, WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote, resolveAuthScheme } from './index.js';
3
+ export { Account, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, ExecutedTransaction, Felt, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkType, Note, NoteAndArgs, NoteAssets, NoteAttachment, NoteAttachmentKind, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapInfo, StorageMapUpdate, StorageSlot, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, setupLogging } from './Cargo-M3382VZc.js';
4
4
  import './wasm.js';
5
5
 
6
6
  // Eager entry point for @miden-sdk/miden-sdk.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,13 @@ export * from "./crates/miden_client_web";
4
4
  // Re-export all simplified API types
5
5
  export * from "./api-types";
6
6
 
7
+ // Explicit re-export to shadow the wasm-bindgen `AuthScheme` enum declared
8
+ // in `./crates/miden_client_web` with the user-facing string constant plus
9
+ // merged string-union type from `./api-types`. Without this, `export *`
10
+ // makes the name ambiguous and TypeScript resolves to the crates enum,
11
+ // breaking `AuthScheme.Falcon` / `AuthScheme.ECDSA` lookups.
12
+ export { AuthScheme, resolveAuthScheme } from "./api-types";
13
+
7
14
  // Import types needed for the @internal class declarations below
8
15
  import type {
9
16
  WebClient as WasmWebClientBase,
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
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, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentKind, 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, 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, setupLogging } from './Cargo-Bwjf7IkR.js';
2
+ import { AccountArray as AccountArray$1, AccountIdArray as AccountIdArray$1, FeltArray as FeltArray$1, ForeignAccountArray as ForeignAccountArray$1, NoteAndArgsArray as NoteAndArgsArray$1, NoteArray as NoteArray$1, NoteIdAndArgsArray as NoteIdAndArgsArray$1, NoteRecipientArray as NoteRecipientArray$1, OutputNoteArray as OutputNoteArray$1, StorageSlotArray as StorageSlotArray$1, TransactionScriptInputPairArray as TransactionScriptInputPairArray$1 } from './Cargo-M3382VZc.js';
3
+ export { Account, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, ExecutedTransaction, Felt, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkType, Note, NoteAndArgs, NoteAssets, NoteAttachment, NoteAttachmentKind, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapInfo, StorageMapUpdate, StorageSlot, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, setupLogging } from './Cargo-M3382VZc.js';
3
4
 
4
5
  const WorkerAction = Object.freeze({
5
6
  INIT: "init",
@@ -345,18 +346,31 @@ function resolveStorageMode(mode, wasm) {
345
346
  }
346
347
 
347
348
  /**
348
- * Resolves an auth scheme string to a WASM AuthScheme enum value.
349
+ * Resolves an auth scheme string to a WASM `AuthScheme` enum numeric value.
349
350
  *
350
- * @param {string | undefined} scheme - "falcon" or "ecdsa". Defaults to "falcon".
351
- * @param {object} wasm - The WASM module.
352
- * @returns {number} The AuthScheme enum value.
351
+ * The public `AuthScheme` constant exposes SDK-friendly strings
352
+ * (`"falcon"` / `"ecdsa"`), but low-level wasm-bindgen methods such as
353
+ * `AccountComponent.createAuthComponentFromCommitment(commitment, scheme)`
354
+ * expect the numeric variant from the Rust `AuthScheme` enum. This helper
355
+ * bridges the two so callers never touch wasm-bindgen internals directly.
356
+ *
357
+ * `wasm` is optional: when provided (by internal callers who already have
358
+ * the module loaded), the numeric value is read from the binding itself,
359
+ * keeping the mapping robust if wasm-bindgen ever renumbers the enum. When
360
+ * omitted (public callers who don't have a handle to the WASM module), the
361
+ * hardcoded discriminants below are used — these are pinned to the Rust
362
+ * enum order by a cross-check test in `test/account_component.test.ts`.
363
+ *
364
+ * @param {"falcon" | "ecdsa" | undefined} scheme - Defaults to `"falcon"`.
365
+ * @param {object} [wasm] - Optional WASM module handle.
366
+ * @returns {number} The AuthScheme enum numeric value (1 or 2).
353
367
  */
354
368
  function resolveAuthScheme(scheme, wasm) {
355
369
  if (scheme === "ecdsa") {
356
- return wasm.AuthScheme.AuthEcdsaK256Keccak;
370
+ return wasm?.AuthScheme?.AuthEcdsaK256Keccak ?? 1;
357
371
  }
358
372
  if (scheme === "falcon" || scheme == null) {
359
- return wasm.AuthScheme.AuthRpoFalcon512;
373
+ return wasm?.AuthScheme?.AuthRpoFalcon512 ?? 2;
360
374
  }
361
375
  throw new Error(
362
376
  `Unknown auth scheme: "${scheme}". Expected "falcon" or "ecdsa".`
@@ -2006,6 +2020,57 @@ function buildNoteAssets(assets, wasm) {
2006
2020
  return new wasm.NoteAssets(fungibleAssets);
2007
2021
  }
2008
2022
 
2023
+ /**
2024
+ * Non-consuming wrappers for wasm-bindgen-generated array classes.
2025
+ *
2026
+ * The default wasm-bindgen-generated constructor for an exported `Vec<T>`
2027
+ * parameter (e.g. `pub fn new(elements: Option<Vec<Note>>) -> Self`) takes
2028
+ * each input element by value: the Rust-side value is moved out of the
2029
+ * caller's JS handle. The handle is left dangling — its `__wbg_ptr` field
2030
+ * is unchanged so the JS object looks fine, but any subsequent method call
2031
+ * panics inside WASM with the opaque `"null pointer passed to rust"`
2032
+ * error from wasm-bindgen.
2033
+ *
2034
+ * That's a footgun for JS users, who don't expect "this object can no
2035
+ * longer be used" semantics from a constructor like
2036
+ * `new NoteArray([note])`. So we wrap each affected array with a class
2037
+ * that builds the same array via `push(&T)` — which already borrows +
2038
+ * clones — leaving the originals fully usable afterwards.
2039
+ *
2040
+ * The wrapper extends the wasm-bindgen base class, so `instanceof` checks
2041
+ * (including `_assertClass(...)` in other auto-generated wasm-bindgen
2042
+ * methods) keep working transparently.
2043
+ */
2044
+
2045
+
2046
+ function makeSafeArray(Base) {
2047
+ return class extends Base {
2048
+ constructor(elements) {
2049
+ super(); // empty Rust Vec — no consume
2050
+ if (Array.isArray(elements)) {
2051
+ for (const el of elements) {
2052
+ // push(&T) on Base borrows and clones — input handles stay valid.
2053
+ this.push(el);
2054
+ }
2055
+ }
2056
+ }
2057
+ };
2058
+ }
2059
+
2060
+ const AccountArray = makeSafeArray(AccountArray$1);
2061
+ const AccountIdArray = makeSafeArray(AccountIdArray$1);
2062
+ const FeltArray = makeSafeArray(FeltArray$1);
2063
+ const ForeignAccountArray = makeSafeArray(ForeignAccountArray$1);
2064
+ const NoteAndArgsArray = makeSafeArray(NoteAndArgsArray$1);
2065
+ const NoteArray = makeSafeArray(NoteArray$1);
2066
+ const NoteIdAndArgsArray = makeSafeArray(NoteIdAndArgsArray$1);
2067
+ const NoteRecipientArray = makeSafeArray(NoteRecipientArray$1);
2068
+ const OutputNoteArray = makeSafeArray(OutputNoteArray$1);
2069
+ const StorageSlotArray = makeSafeArray(StorageSlotArray$1);
2070
+ const TransactionScriptInputPairArray = makeSafeArray(
2071
+ TransactionScriptInputPairArray$1
2072
+ );
2073
+
2009
2074
  const AccountType = Object.freeze({
2010
2075
  // WASM-compatible numeric values — usable with AccountBuilder directly
2011
2076
  FungibleFaucet: 0,
@@ -3189,5 +3254,5 @@ MidenClient._MockWasmWebClient = MockWebClient;
3189
3254
  MidenClient._getWasmOrThrow = getWasmOrThrow;
3190
3255
  _setWebClient(WebClient);
3191
3256
 
3192
- export { AccountType, AuthScheme, CompilerResource, Linking, MidenArrays, MidenClient, MockWebClient as MockWasmWebClient, NoteVisibility, StorageMode, WebClient as WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote, getWasmOrThrow };
3257
+ export { AccountArray, AccountIdArray, AccountType, AuthScheme, CompilerResource, FeltArray, ForeignAccountArray, Linking, MidenArrays, MidenClient, MockWebClient as MockWasmWebClient, NoteAndArgsArray, NoteArray, NoteIdAndArgsArray, NoteRecipientArray, NoteVisibility, OutputNoteArray, StorageMode, StorageSlotArray, TransactionScriptInputPairArray, WebClient as WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote, getWasmOrThrow, resolveAuthScheme };
3193
3258
  //# sourceMappingURL=index.js.map