@miden-sdk/miden-sdk 0.15.7 → 0.15.8

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.
Files changed (37) hide show
  1. package/dist/mt/{Cargo-CnGom-_z.js → Cargo-CvYxNO9A.js} +159 -76
  2. package/dist/mt/Cargo-CvYxNO9A.js.map +1 -0
  3. package/dist/mt/assets/miden_client_web.wasm +0 -0
  4. package/dist/mt/crates/miden_client_web.d.ts +49 -1
  5. package/dist/mt/eager.js +1 -1
  6. package/dist/mt/index.js +28 -1
  7. package/dist/mt/index.js.map +1 -1
  8. package/dist/mt/wasm.js +1 -1
  9. package/dist/mt/workerHelpers.js +1 -1
  10. package/dist/mt/workers/{Cargo-CnGom-_z-X_3VwTbo.js → Cargo-CvYxNO9A-D_wSZjuK.js} +159 -76
  11. package/dist/mt/workers/Cargo-CvYxNO9A-D_wSZjuK.js.map +1 -0
  12. package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
  13. package/dist/mt/workers/web-client-methods-worker.js +160 -77
  14. package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
  15. package/dist/mt/workers/web-client-methods-worker.module.js +1 -1
  16. package/dist/mt/workers/web-client-methods-worker.module.js.map +1 -1
  17. package/dist/mt/workers/workerHelpers.js +1 -1
  18. package/dist/st/{Cargo-DR9fiMbE.js → Cargo-L_lPKfww.js} +158 -75
  19. package/dist/st/Cargo-L_lPKfww.js.map +1 -0
  20. package/dist/st/assets/miden_client_web.wasm +0 -0
  21. package/dist/st/crates/miden_client_web.d.ts +49 -1
  22. package/dist/st/eager.js +1 -1
  23. package/dist/st/index.js +28 -1
  24. package/dist/st/index.js.map +1 -1
  25. package/dist/st/wasm.js +1 -1
  26. package/dist/st/workers/{Cargo-DR9fiMbE-C0G0clA_.js → Cargo-L_lPKfww-BM__buYN.js} +158 -75
  27. package/dist/st/workers/Cargo-L_lPKfww-BM__buYN.js.map +1 -0
  28. package/dist/st/workers/assets/miden_client_web.wasm +0 -0
  29. package/dist/st/workers/web-client-methods-worker.js +159 -76
  30. package/dist/st/workers/web-client-methods-worker.js.map +1 -1
  31. package/dist/st/workers/web-client-methods-worker.module.js +1 -1
  32. package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
  33. package/package.json +4 -4
  34. package/dist/mt/Cargo-CnGom-_z.js.map +0 -1
  35. package/dist/mt/workers/Cargo-CnGom-_z-X_3VwTbo.js.map +0 -1
  36. package/dist/st/Cargo-DR9fiMbE.js.map +0 -1
  37. package/dist/st/workers/Cargo-DR9fiMbE-C0G0clA_.js.map +0 -1
@@ -1049,6 +1049,16 @@ export class BasicFungibleFaucetComponent {
1049
1049
  * Extracts faucet metadata from an account.
1050
1050
  */
1051
1051
  static fromAccount(account: Account): BasicFungibleFaucetComponent;
1052
+ /**
1053
+ * Extracts faucet metadata from an account's storage.
1054
+ *
1055
+ * Unlike [`Self::from_account`], this reads the metadata straight from the storage slots
1056
+ * without checking that the account exposes the basic fungible faucet interface. This makes
1057
+ * it work for faucets built from custom components that reuse the standards storage layout
1058
+ * (e.g. `AggLayer` bridged-asset faucets), but it also means a non-faucet account whose
1059
+ * storage happens to use the same slot names would yield bogus metadata without an error.
1060
+ */
1061
+ static fromAccountStorage(account_storage: AccountStorage): BasicFungibleFaucetComponent;
1052
1062
  /**
1053
1063
  * Returns the optional token logo URI, or `undefined` when unset.
1054
1064
  */
@@ -1623,13 +1633,51 @@ export class FungibleAsset {
1623
1633
  */
1624
1634
  faucetId(): AccountId;
1625
1635
  /**
1626
- * Encodes this asset into the word layout used in the vault.
1636
+ * Reconstructs a fungible asset from its vault entry the `(key, value)`
1637
+ * word pair as stored in an account vault, i.e. the outputs of
1638
+ * [`vaultKey`](Self::vault_key) and [`intoWord`](Self::into_word). The key
1639
+ * word carries the faucet id and the callback flag; the value word carries
1640
+ * the amount. This is the inverse of those getters, so
1641
+ * `FungibleAsset.fromVaultEntry(a.vaultKey(), a.intoWord())` round-trips an
1642
+ * asset read from vault data (callback flag included). Errors if the words
1643
+ * don't describe a valid fungible asset (e.g. a malformed key, non-zero
1644
+ * upper limbs in the value word, or an amount above the maximum fungible
1645
+ * asset amount, `2^63 - 2^31`).
1646
+ */
1647
+ static fromVaultEntry(key: Word, value: Word): FungibleAsset;
1648
+ /**
1649
+ * Reconstructs a fungible asset from its vault key word and a scalar amount.
1650
+ *
1651
+ * A convenience over [`fromVaultEntry`](Self::from_vault_entry) for when you
1652
+ * hold the key word (from [`vaultKey`](Self::vault_key)) and the amount as a
1653
+ * number rather than the value word: the key supplies the faucet id and
1654
+ * callback flag, and the amount is encoded into the value word for you. Use
1655
+ * `fromVaultEntry` when you already have both vault words. Errors on a
1656
+ * malformed key or an amount above the maximum fungible asset amount,
1657
+ * `2^63 - 2^31`.
1658
+ */
1659
+ static fromVaultKey(key: Word, amount: bigint): FungibleAsset;
1660
+ /**
1661
+ * Returns the value word stored under [`vaultKey`](Self::vault_key) in an
1662
+ * account vault. For a fungible asset the value word encodes the amount.
1663
+ *
1664
+ * This is the value half of the vault entry; pair it with `vaultKey()` and
1665
+ * pass both to [`fromVaultEntry`](Self::from_vault_entry) to reconstruct the
1666
+ * asset.
1627
1667
  */
1628
1668
  intoWord(): Word;
1629
1669
  /**
1630
1670
  * Creates a fungible asset for the given faucet and amount.
1631
1671
  */
1632
1672
  constructor(faucet_id: AccountId, amount: bigint);
1673
+ /**
1674
+ * Returns the key word under which this asset is stored in an account vault.
1675
+ *
1676
+ * The key encodes the faucet id and the callback flag; the amount lives in
1677
+ * the paired value word from [`intoWord`](Self::into_word). Pass both back
1678
+ * into [`fromVaultEntry`](Self::from_vault_entry) to reconstruct the asset.
1679
+ */
1680
+ vaultKey(): Word;
1633
1681
  /**
1634
1682
  * Returns a copy of this asset carrying the given callback flag.
1635
1683
  *
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, AssetCallbackFlag, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-CnGom-_z.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, AssetCallbackFlag, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-CvYxNO9A.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, AssetCallbackFlag, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-CnGom-_z.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, AssetCallbackFlag, 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, initThreadPool, mtProbeAsync, mtProbeSync, parallelSumBench, rayonThreadCount, sequentialSumBench, setupLogging, wbg_rayon_PoolBuilder, wbg_rayon_start_worker } from './Cargo-CvYxNO9A.js';
3
3
 
4
4
  const WorkerAction = Object.freeze({
5
5
  INIT: "init",
@@ -3132,6 +3132,33 @@ function installStorageView(wasmModule) {
3132
3132
  const raw = originalStorage.call(this);
3133
3133
  return new StorageView(raw, WordClass);
3134
3134
  };
3135
+
3136
+ // WASM statics that take a raw AccountStorage argument must accept the
3137
+ // StorageView that account.storage() now returns — unwrap it before the
3138
+ // wasm-bindgen instanceof guard rejects it. The napi class freezes its
3139
+ // statics (non-writable, non-configurable) so it cannot be patched here;
3140
+ // its Rust-side FromNapiValue impl accepts StorageView natively instead.
3141
+ const FaucetComponent = wasmModule.BasicFungibleFaucetComponent;
3142
+ const descriptor =
3143
+ FaucetComponent &&
3144
+ Object.getOwnPropertyDescriptor(FaucetComponent, "fromAccountStorage");
3145
+ if (
3146
+ descriptor?.value &&
3147
+ (descriptor.writable || descriptor.configurable) &&
3148
+ !descriptor.value.__unwrapsStorageView
3149
+ ) {
3150
+ const originalFromStorage = descriptor.value.bind(FaucetComponent);
3151
+ const unwrapping = (storage) =>
3152
+ originalFromStorage(
3153
+ storage instanceof StorageView ? storage.raw : storage
3154
+ );
3155
+ unwrapping.__unwrapsStorageView = true;
3156
+ Object.defineProperty(FaucetComponent, "fromAccountStorage", {
3157
+ value: unwrapping,
3158
+ writable: true,
3159
+ configurable: true,
3160
+ });
3161
+ }
3135
3162
  }
3136
3163
 
3137
3164
  const AccountType = Object.freeze({