@miden-sdk/react 0.15.6 → 0.16.0-alpha.1

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/lazy.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { AccountId, Account, AccountHeader, AccountStorageMode, AccountComponent, NoteId, InputNoteRecord, Note, StorageMode, AuthScheme, NoteExecutionHint, NoteRecipient, NoteScript, TransactionScript, AdviceInputs, AccountStorageRequirements, TransactionRequest, WasmWebClient, AccountFile, NoteVisibility, ConsumableNoteRecord, NoteInput, PswapLineageRecord, TransactionId, TransactionFilter, TransactionRecord, TransactionProver, CompileComponentOptions, CompileTxScriptOptions, CompileNoteScriptOptions, NoteAttachment } from '@miden-sdk/miden-sdk';
5
- export { Account, AccountFile, AccountHeader, AccountId, AccountStorageMode, AuthScheme, ConsumableNoteRecord, InputNoteRecord, Note, NoteType, PswapLineageRecord, TransactionFilter, TransactionId, TransactionRecord, TransactionRequest, WasmWebClient as WebClient } from '@miden-sdk/miden-sdk';
4
+ import { AccountId, Account, AccountHeader, AccountStorageMode, AccountComponent, NoteId, InputNoteRecord, Note, StorageMode, AuthScheme, TransactionScript, AdviceInputs, AccountStorageRequirements, TransactionRequest, WasmWebClient, AccountFile, NoteVisibility, ConsumableNoteRecord, NoteInput, TransactionId, TransactionFilter, TransactionRecord, TransactionProver, CompileComponentOptions, CompileTxScriptOptions, CompileNoteScriptOptions, NoteScript, NoteAttachment } from '@miden-sdk/miden-sdk';
5
+ export { Account, AccountFile, AccountHeader, AccountId, AccountStorageMode, AuthScheme, ConsumableNoteRecord, InputNoteRecord, Note, NoteType, TransactionFilter, TransactionId, TransactionRecord, TransactionRequest, WasmWebClient as WebClient } from '@miden-sdk/miden-sdk';
6
6
 
7
7
  declare module "@miden-sdk/miden-sdk" {
8
8
  interface Account {
@@ -392,46 +392,6 @@ interface MintOptions {
392
392
  /** Note type. Default: private */
393
393
  noteType?: NoteVisibility;
394
394
  }
395
- interface CreateNetworkNoteOptions {
396
- /** Account that creates, funds, and submits the note (executing sender). */
397
- accountId: AccountRef;
398
- /** The network account the note targets. */
399
- target: AccountRef;
400
- /** Execution hint. Defaults to `always`. */
401
- executionHint?: NoteExecutionHint;
402
- /** Recipient carrying the custom script (advanced; else pass `script`). */
403
- recipient?: NoteRecipient;
404
- /** Custom consumption script; the recipient is built for you. */
405
- script?: NoteScript;
406
- /** Note storage / inputs the script reads (used with `script`). */
407
- inputs?: bigint[];
408
- /** Single asset to lock into the note. Optional — omit for a zero-asset note. */
409
- assetId?: AccountRef;
410
- /** Amount for `assetId`. */
411
- amount?: bigint | number;
412
- /** Extra attachment payload appended after the NetworkAccountTarget. */
413
- attachment?: bigint[] | Uint8Array | number[];
414
- }
415
- interface NetworkNoteResult {
416
- txId: string;
417
- note: Note;
418
- }
419
- interface BridgeOptions {
420
- /** Account that creates and funds the bridge note (the sender) */
421
- from: AccountRef;
422
- /** Bridge account that consumes the note and burns the bridged assets */
423
- bridgeAccount: AccountRef;
424
- /** Faucet/token ID of the fungible asset to bridge */
425
- assetId: AccountRef;
426
- /** Amount of the asset to bridge */
427
- amount: bigint | number;
428
- /** AggLayer-assigned network ID of the destination chain */
429
- destinationNetwork: number;
430
- /** Destination Ethereum address on the destination network (0x-prefixed hex) */
431
- destinationAddress: string;
432
- /** Skip auto-sync after bridging. Default: false */
433
- skipSync?: boolean;
434
- }
435
395
  interface ConsumeOptions {
436
396
  /** Account ID that will consume the notes */
437
397
  accountId: string;
@@ -502,29 +462,6 @@ interface PswapCancelOptions {
502
462
  */
503
463
  note: NoteInput;
504
464
  }
505
- interface PswapCancelByOrderOptions {
506
- /**
507
- * Stable order id of the lineage to cancel (decimal string or bigint).
508
- * `number` is not accepted: a PSWAP order id is `u64`-shaped and routinely
509
- * exceeds `Number.MAX_SAFE_INTEGER`, which a JS `number` cannot represent
510
- * without silent precision loss.
511
- */
512
- orderId: string | bigint;
513
- }
514
- interface PswapLineagesResult {
515
- /** Tracked PSWAP lineages. */
516
- lineages: PswapLineageRecord[];
517
- isLoading: boolean;
518
- error: Error | null;
519
- refetch: () => Promise<void>;
520
- }
521
- interface PswapLineageResult {
522
- /** The tracked lineage, or `null` if not tracked. */
523
- lineage: PswapLineageRecord | null;
524
- isLoading: boolean;
525
- error: Error | null;
526
- refetch: () => Promise<void>;
527
- }
528
465
  interface ExecuteTransactionOptions {
529
466
  /** Account ID the transaction applies to */
530
467
  accountId: AccountRef;
@@ -877,74 +814,6 @@ declare function useAssetMetadata(assetIds?: string[]): {
877
814
  assetMetadata: Map<string, AssetMetadata>;
878
815
  };
879
816
 
880
- /**
881
- * Hook to list every partial-swap (PSWAP) lineage tracked by this client.
882
- *
883
- * A lineage records how a PSWAP note has been filled round by round, from the
884
- * original note through each remainder to the current tip. The list refreshes
885
- * after each successful sync.
886
- *
887
- * @example
888
- * ```tsx
889
- * function LineageList() {
890
- * const { lineages, isLoading } = usePswapLineages();
891
- * if (isLoading) return <div>Loading...</div>;
892
- * return (
893
- * <ul>
894
- * {lineages.map((l) => (
895
- * <li key={l.orderId()}>
896
- * {l.orderId()} — {l.remainingOffered().toString()} remaining
897
- * </li>
898
- * ))}
899
- * </ul>
900
- * );
901
- * }
902
- * ```
903
- */
904
- declare function usePswapLineages(): PswapLineagesResult;
905
- type UsePswapLineagesResult = PswapLineagesResult;
906
-
907
- /**
908
- * Hook to list the partial-swap (PSWAP) lineages created by a specific local
909
- * account. Refreshes after each successful sync.
910
- *
911
- * @param account - Creator account (hex, bech32, `Account`, or `AccountId`).
912
- *
913
- * @example
914
- * ```tsx
915
- * function MyLineages({ accountId }: { accountId: string }) {
916
- * const { lineages, isLoading } = usePswapLineagesFor(accountId);
917
- * if (isLoading) return <div>Loading...</div>;
918
- * return <div>{lineages.length} open orders</div>;
919
- * }
920
- * ```
921
- */
922
- declare function usePswapLineagesFor(account: AccountRef | null | undefined): PswapLineagesResult;
923
- type UsePswapLineagesForResult = PswapLineagesResult;
924
-
925
- /**
926
- * Hook to fetch a single partial-swap (PSWAP) lineage by its stable order id.
927
- * Returns `null` if this client is not tracking the order. Refreshes after each
928
- * successful sync.
929
- *
930
- * @param orderId - Stable order id (decimal string or bigint). `number` is
931
- * not accepted: a PSWAP order id is `u64`-shaped and routinely exceeds
932
- * `Number.MAX_SAFE_INTEGER`, which a JS `number` cannot represent without
933
- * silent precision loss.
934
- *
935
- * @example
936
- * ```tsx
937
- * function OrderStatus({ orderId }: { orderId: string }) {
938
- * const { lineage, isLoading } = usePswapLineage(orderId);
939
- * if (isLoading) return <div>Loading...</div>;
940
- * if (!lineage) return <div>Not tracked</div>;
941
- * return <div>State: {lineage.state()}</div>;
942
- * }
943
- * ```
944
- */
945
- declare function usePswapLineage(orderId: string | bigint | null | undefined): PswapLineageResult;
946
- type UsePswapLineageResult = PswapLineageResult;
947
-
948
817
  interface UseCreateWalletResult {
949
818
  /** Create a new wallet with optional configuration */
950
819
  createWallet: (options?: CreateWalletOptions) => Promise<Account>;
@@ -1214,61 +1083,6 @@ interface UseMintResult {
1214
1083
  */
1215
1084
  declare function useMint(): UseMintResult;
1216
1085
 
1217
- interface UseBridgeResult {
1218
- /** Bridge a fungible asset out to another network via the AggLayer */
1219
- bridge: (options: BridgeOptions) => Promise<TransactionResult>;
1220
- /** The transaction result */
1221
- result: TransactionResult | null;
1222
- /** Whether the transaction is in progress */
1223
- isLoading: boolean;
1224
- /** Current stage of the transaction */
1225
- stage: TransactionStage;
1226
- /** Error if transaction failed */
1227
- error: Error | null;
1228
- /** Reset the hook state */
1229
- reset: () => void;
1230
- }
1231
- /**
1232
- * Hook to bridge a fungible asset out to another network via the AggLayer.
1233
- *
1234
- * Emits a single public B2AGG (Bridge-to-AggLayer) note that the bridge account consumes,
1235
- * burning the asset so it can be claimed at the destination Ethereum address on the destination
1236
- * network. The sender account executes the transaction that emits the note.
1237
- *
1238
- * Returns `{ bridge, result, isLoading, stage, error, reset }`. `bridge` resolves to a
1239
- * `TransactionResult` (`{ transactionId }`) and rejects on failure.
1240
- *
1241
- * @example
1242
- * ```tsx
1243
- * function BridgeButton({ from, bridgeAccount, assetId }: Props) {
1244
- * const { bridge, isLoading, stage, error } = useBridge();
1245
- *
1246
- * const handleBridge = async () => {
1247
- * try {
1248
- * const result = await bridge({
1249
- * from,
1250
- * bridgeAccount,
1251
- * assetId,
1252
- * amount: 100n,
1253
- * destinationNetwork: 1,
1254
- * destinationAddress: "0x000000000000000000000000000000000000dEaD",
1255
- * });
1256
- * console.log("Bridged! TX:", result.transactionId);
1257
- * } catch (err) {
1258
- * console.error("Bridge failed:", err);
1259
- * }
1260
- * };
1261
- *
1262
- * return (
1263
- * <button onClick={handleBridge} disabled={isLoading}>
1264
- * {isLoading ? stage : "Bridge"}
1265
- * </button>
1266
- * );
1267
- * }
1268
- * ```
1269
- */
1270
- declare function useBridge(): UseBridgeResult;
1271
-
1272
1086
  interface UseConsumeResult {
1273
1087
  /** Consume one or more notes */
1274
1088
  consume: (options: ConsumeOptions) => Promise<TransactionResult>;
@@ -1482,56 +1296,6 @@ interface UsePswapCancelResult {
1482
1296
  */
1483
1297
  declare function usePswapCancel(): UsePswapCancelResult;
1484
1298
 
1485
- interface UsePswapCancelByOrderResult {
1486
- /** Cancel a PSWAP lineage by its stable order id, reclaiming the unfilled offered asset. */
1487
- pswapCancelByOrder: (options: PswapCancelByOrderOptions) => Promise<TransactionResult>;
1488
- /** The transaction result */
1489
- result: TransactionResult | null;
1490
- /** Whether the transaction is in progress */
1491
- isLoading: boolean;
1492
- /** Current stage of the transaction */
1493
- stage: TransactionStage;
1494
- /** Error if transaction failed */
1495
- error: Error | null;
1496
- /** Reset the hook state */
1497
- reset: () => void;
1498
- }
1499
- /**
1500
- * Hook to cancel a PSWAP lineage by its stable order id and reclaim the
1501
- * unfilled offered asset on the lineage's current tip. Unlike
1502
- * {@link usePswapCancel}, the creator account and tip note are resolved from
1503
- * the locally tracked lineage, so only the order id is required.
1504
- *
1505
- * @example
1506
- * ```tsx
1507
- * function CancelOrderButton({ orderId }: { orderId: string }) {
1508
- * const { pswapCancelByOrder, isLoading, stage } = usePswapCancelByOrder();
1509
- * return (
1510
- * <button onClick={() => pswapCancelByOrder({ orderId })} disabled={isLoading}>
1511
- * {isLoading ? stage : "Cancel order"}
1512
- * </button>
1513
- * );
1514
- * }
1515
- * ```
1516
- */
1517
- declare function usePswapCancelByOrder(): UsePswapCancelByOrderResult;
1518
-
1519
- interface UseCreateNetworkNoteResult {
1520
- /** Build + submit a Public custom-script network note. */
1521
- createNetworkNote: (options: CreateNetworkNoteOptions) => Promise<NetworkNoteResult>;
1522
- result: NetworkNoteResult | null;
1523
- isLoading: boolean;
1524
- stage: TransactionStage;
1525
- error: Error | null;
1526
- reset: () => void;
1527
- }
1528
- /**
1529
- * Hook that builds a Public custom-script note carrying a `NetworkAccountTarget`
1530
- * attachment and submits it as an own output note, so a public network account
1531
- * auto-consumes it. Provide exactly one of `recipient` or `script`.
1532
- */
1533
- declare function useCreateNetworkNote(): UseCreateNetworkNoteResult;
1534
-
1535
1299
  interface UseTransactionResult {
1536
1300
  /** Execute a transaction request end-to-end */
1537
1301
  execute: (options: ExecuteTransactionOptions) => Promise<TransactionResult>;
@@ -1951,4 +1715,4 @@ declare function createMidenStorage(prefix: string): {
1951
1715
  clear(): void;
1952
1716
  };
1953
1717
 
1954
- export { type AccountRef, type AccountResult, type AccountsResult, type AssetBalance, type AssetMetadata, type BridgeOptions, type ConsumeOptions, type CreateFaucetOptions, type CreateNetworkNoteOptions, type CreateWalletOptions, DEFAULTS, type ExecuteProgramOptions, type ExecuteProgramResult, type ExecuteTransactionOptions, type ImportAccountOptions, type ImportStoreOptions, type MidenConfig, MidenError, type MidenErrorCode, MidenProvider, type MidenState, type MigrateStorageOptions, type MintOptions, type MultiSendOptions, type MultiSendRecipient, type MultiSignerContextValue, MultiSignerProvider, type MutationResult, type NetworkNoteResult, type NoteAsset, type NoteAttachmentData, type NoteSummary, type NotesFilter, type NotesResult, type ProverConfig, type ProverTarget, type ProverUrls, type PswapCancelByOrderOptions, type PswapCancelOptions, type PswapConsumeOptions, type PswapCreateOptions, type PswapLineageResult, type PswapLineagesResult, type QueryResult, type RpcUrlConfig, type SendOptions, type SendResult, type SessionAccountStep, type SignCallback, type SignerAccountConfig, type SignerAccountType, SignerContext, type SignerContextValue, SignerSlot, type StreamedNote, type SwapOptions, type SyncState, type TransactionHistoryOptions, type TransactionHistoryResult, type TransactionResult, type TransactionStage, type TransactionStatus, type UseBridgeResult, type UseCompileResult, type UseConsumeResult, type UseCreateFaucetResult, type UseCreateNetworkNoteResult, type UseCreateWalletResult, type UseExecuteProgramResult, type UseExportNoteResult, type UseExportStoreResult, type UseImportAccountResult, type UseImportNoteResult, type UseImportStoreResult, type UseMintResult, type UseMultiSendResult, type UseNoteStreamOptions, type UseNoteStreamReturn, type UsePswapCancelByOrderResult, type UsePswapCancelResult, type UsePswapConsumeResult, type UsePswapCreateResult, type UsePswapLineageResult, type UsePswapLineagesForResult, type UsePswapLineagesResult, type UseSendResult, type UseSessionAccountOptions, type UseSessionAccountReturn, type UseSwapResult, type UseSyncControlResult, type UseSyncStateResult, type UseTransactionHistoryResult, type UseTransactionResult, type UseWaitForCommitResult, type UseWaitForNotesResult, type WaitForCommitOptions, type WaitForNotesOptions, type WalletAdapterLike, accountIdsEqual, bigIntToBytes, bytesToBigInt, clearMidenStorage, concatBytes, createMidenStorage, createNoteAttachment, ensureAccountBech32, formatAssetAmount, formatNoteSummary, getNoteSummary, installAccountBech32, migrateStorage, normalizeAccountId, parseAssetAmount, readNoteAttachment, toBech32AccountId, useAccount, useAccounts, useAssetMetadata, useBridge, useCompile, useConsume, useCreateFaucet, useCreateNetworkNote, useCreateWallet, useExecuteProgram, useExportNote, useExportStore, useImportAccount, useImportNote, useImportStore, useMiden, useMidenClient, useMint, useMultiSend, useMultiSigner, useNoteStream, useNotes, usePswapCancel, usePswapCancelByOrder, usePswapConsume, usePswapCreate, usePswapLineage, usePswapLineages, usePswapLineagesFor, useSend, useSessionAccount, useSigner, useSwap, useSyncControl, useSyncState, useTransaction, useTransactionHistory, useWaitForCommit, useWaitForNotes, waitForWalletDetection, wrapWasmError };
1718
+ export { type AccountRef, type AccountResult, type AccountsResult, type AssetBalance, type AssetMetadata, type ConsumeOptions, type CreateFaucetOptions, type CreateWalletOptions, DEFAULTS, type ExecuteProgramOptions, type ExecuteProgramResult, type ExecuteTransactionOptions, type ImportAccountOptions, type ImportStoreOptions, type MidenConfig, MidenError, type MidenErrorCode, MidenProvider, type MidenState, type MigrateStorageOptions, type MintOptions, type MultiSendOptions, type MultiSendRecipient, type MultiSignerContextValue, MultiSignerProvider, type MutationResult, type NoteAsset, type NoteAttachmentData, type NoteSummary, type NotesFilter, type NotesResult, type ProverConfig, type ProverTarget, type ProverUrls, type PswapCancelOptions, type PswapConsumeOptions, type PswapCreateOptions, type QueryResult, type RpcUrlConfig, type SendOptions, type SendResult, type SessionAccountStep, type SignCallback, type SignerAccountConfig, type SignerAccountType, SignerContext, type SignerContextValue, SignerSlot, type StreamedNote, type SwapOptions, type SyncState, type TransactionHistoryOptions, type TransactionHistoryResult, type TransactionResult, type TransactionStage, type TransactionStatus, type UseCompileResult, type UseConsumeResult, type UseCreateFaucetResult, type UseCreateWalletResult, type UseExecuteProgramResult, type UseExportNoteResult, type UseExportStoreResult, type UseImportAccountResult, type UseImportNoteResult, type UseImportStoreResult, type UseMintResult, type UseMultiSendResult, type UseNoteStreamOptions, type UseNoteStreamReturn, type UsePswapCancelResult, type UsePswapConsumeResult, type UsePswapCreateResult, type UseSendResult, type UseSessionAccountOptions, type UseSessionAccountReturn, type UseSwapResult, type UseSyncControlResult, type UseSyncStateResult, type UseTransactionHistoryResult, type UseTransactionResult, type UseWaitForCommitResult, type UseWaitForNotesResult, type WaitForCommitOptions, type WaitForNotesOptions, type WalletAdapterLike, accountIdsEqual, bigIntToBytes, bytesToBigInt, clearMidenStorage, concatBytes, createMidenStorage, createNoteAttachment, ensureAccountBech32, formatAssetAmount, formatNoteSummary, getNoteSummary, installAccountBech32, migrateStorage, normalizeAccountId, parseAssetAmount, readNoteAttachment, toBech32AccountId, useAccount, useAccounts, useAssetMetadata, useCompile, useConsume, useCreateFaucet, useCreateWallet, useExecuteProgram, useExportNote, useExportStore, useImportAccount, useImportNote, useImportStore, useMiden, useMidenClient, useMint, useMultiSend, useMultiSigner, useNoteStream, useNotes, usePswapCancel, usePswapConsume, usePswapCreate, useSend, useSessionAccount, useSigner, useSwap, useSyncControl, useSyncState, useTransaction, useTransactionHistory, useWaitForCommit, useWaitForNotes, waitForWalletDetection, wrapWasmError };