@miden-sdk/react 0.15.3 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +34 -0
- package/README.md +2 -0
- package/dist/index.d.ts +113 -2
- package/dist/index.mjs +279 -89
- package/dist/lazy.d.ts +113 -2
- package/dist/lazy.mjs +279 -89
- package/dist/mt/lazy.d.ts +113 -2
- package/dist/mt/lazy.mjs +279 -89
- package/dist/mt.d.ts +113 -2
- package/dist/mt.mjs +279 -89
- package/package.json +3 -3
package/dist/lazy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, TransactionScript, AdviceInputs, AccountStorageRequirements, TransactionRequest, WasmWebClient, AccountFile, NoteVisibility, ConsumableNoteRecord, NoteInput, PswapLineageRecord, TransactionId, TransactionFilter, TransactionRecord, TransactionProver, CompileComponentOptions, CompileTxScriptOptions, CompileNoteScriptOptions,
|
|
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
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';
|
|
6
6
|
|
|
7
7
|
declare module "@miden-sdk/miden-sdk" {
|
|
@@ -392,6 +392,46 @@ 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
|
+
}
|
|
395
435
|
interface ConsumeOptions {
|
|
396
436
|
/** Account ID that will consume the notes */
|
|
397
437
|
accountId: string;
|
|
@@ -1174,6 +1214,61 @@ interface UseMintResult {
|
|
|
1174
1214
|
*/
|
|
1175
1215
|
declare function useMint(): UseMintResult;
|
|
1176
1216
|
|
|
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
|
+
|
|
1177
1272
|
interface UseConsumeResult {
|
|
1178
1273
|
/** Consume one or more notes */
|
|
1179
1274
|
consume: (options: ConsumeOptions) => Promise<TransactionResult>;
|
|
@@ -1421,6 +1516,22 @@ interface UsePswapCancelByOrderResult {
|
|
|
1421
1516
|
*/
|
|
1422
1517
|
declare function usePswapCancelByOrder(): UsePswapCancelByOrderResult;
|
|
1423
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
|
+
|
|
1424
1535
|
interface UseTransactionResult {
|
|
1425
1536
|
/** Execute a transaction request end-to-end */
|
|
1426
1537
|
execute: (options: ExecuteTransactionOptions) => Promise<TransactionResult>;
|
|
@@ -1840,4 +1951,4 @@ declare function createMidenStorage(prefix: string): {
|
|
|
1840
1951
|
clear(): void;
|
|
1841
1952
|
};
|
|
1842
1953
|
|
|
1843
|
-
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 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 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 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, useCompile, useConsume, useCreateFaucet, 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 };
|
|
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 };
|