@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/CLAUDE.md +0 -38
- package/README.md +0 -60
- package/dist/index.d.ts +3 -239
- package/dist/index.mjs +136 -529
- package/dist/lazy.d.ts +3 -239
- package/dist/lazy.mjs +136 -529
- package/dist/mt/lazy.d.ts +3 -239
- package/dist/mt/lazy.mjs +136 -529
- package/dist/mt.d.ts +3 -239
- package/dist/mt.mjs +136 -529
- package/package.json +3 -3
package/CLAUDE.md
CHANGED
|
@@ -149,38 +149,6 @@ await mint({
|
|
|
149
149
|
});
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
### Bridge Out (AggLayer)
|
|
153
|
-
```tsx
|
|
154
|
-
const { bridge } = useBridge();
|
|
155
|
-
|
|
156
|
-
// Emits a public B2AGG note that the bridge account consumes, burning the
|
|
157
|
-
// asset so it can be claimed at the destination Ethereum address.
|
|
158
|
-
await bridge({
|
|
159
|
-
from: senderAccountId,
|
|
160
|
-
bridgeAccount: bridgeAccountId,
|
|
161
|
-
assetId: tokenFaucetId,
|
|
162
|
-
amount: 100n,
|
|
163
|
-
destinationNetwork: 1, // AggLayer-assigned network id
|
|
164
|
-
destinationAddress: "0x000000000000000000000000000000000000dEaD",
|
|
165
|
-
});
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Create a Network Note
|
|
169
|
-
```tsx
|
|
170
|
-
const { createNetworkNote } = useCreateNetworkNote();
|
|
171
|
-
|
|
172
|
-
// Builds a Public custom-script note carrying a NetworkAccountTarget
|
|
173
|
-
// attachment; the targeted network account auto-consumes it on-chain.
|
|
174
|
-
// Provide exactly one of `script` or `recipient`.
|
|
175
|
-
const { txId, note } = await createNetworkNote({
|
|
176
|
-
accountId: senderAccountId,
|
|
177
|
-
target: networkAccountId,
|
|
178
|
-
script: myNoteScript, // or: recipient: myRecipient
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
note.isNetworkNote(); // true
|
|
182
|
-
```
|
|
183
|
-
|
|
184
152
|
### Create Faucet
|
|
185
153
|
```tsx
|
|
186
154
|
const { createFaucet } = useCreateFaucet();
|
|
@@ -426,9 +394,6 @@ Query hooks return `{ ...data, isLoading, error, refetch }`. Mutation hooks retu
|
|
|
426
394
|
| `useTransactionHistory(...)` | `transactions` | Local transaction log |
|
|
427
395
|
| `useSessionAccount()` | `account` | The signer's connected account |
|
|
428
396
|
| `useWaitForNotes(...)` | resolves when matching notes appear | Pull-style note waiting |
|
|
429
|
-
| `usePswapLineages()` | `lineages` | All tracked PSWAP order lineages |
|
|
430
|
-
| `usePswapLineagesFor(creator)` | `lineages` | Tracked PSWAP lineages for one creator |
|
|
431
|
-
| `usePswapLineage(orderId)` | `lineage` | One tracked PSWAP lineage by stable order id |
|
|
432
397
|
|
|
433
398
|
### Mutation (write)
|
|
434
399
|
| Hook | Action | Returns on success |
|
|
@@ -442,14 +407,11 @@ Query hooks return `{ ...data, isLoading, error, refetch }`. Mutation hooks retu
|
|
|
442
407
|
| `useSend()` | `send({ from, to, assetId, amount, noteType })` | `SendResult` (with `txId`, `note`) |
|
|
443
408
|
| `useMultiSend()` | `multiSend({ from, recipients })` | `TransactionResult` |
|
|
444
409
|
| `useMint()` | `mint({ faucetId, to, amount })` | `TransactionResult` |
|
|
445
|
-
| `useBridge()` | `bridge({ from, bridgeAccount, assetId, amount, destinationNetwork, destinationAddress })` | `TransactionResult` (emits an AggLayer B2AGG bridge-out note) |
|
|
446
|
-
| `useCreateNetworkNote()` | `createNetworkNote({ accountId, target, script \| recipient, ... })` | `NetworkNoteResult` (`{ txId, note }`; note satisfies `note.isNetworkNote()`) |
|
|
447
410
|
| `useConsume()` | `consume({ accountId, notes })` | `TransactionResult` |
|
|
448
411
|
| `useSwap()` | `swap({ ... })` | `TransactionResult` |
|
|
449
412
|
| `usePswapCreate()` | `pswapCreate({ accountId, offeredFaucetId, offeredAmount, requestedFaucetId, requestedAmount, ... })` | `TransactionResult` (creates partial-swap note) |
|
|
450
413
|
| `usePswapConsume()` | `pswapConsume({ accountId, note, fillAmount, noteFillAmount? })` — `note` accepts hex string \| `NoteId` \| `InputNoteRecord` \| `Note` | `TransactionResult` (fills PSWAP fully or partially) |
|
|
451
414
|
| `usePswapCancel()` | `pswapCancel({ accountId, note })` — creator only, reclaims unfilled offered asset | `TransactionResult` |
|
|
452
|
-
| `usePswapCancelByOrder()` | `pswapCancelByOrder({ orderId })` — creator only, resolves the current tip + creator from the tracked lineage | `TransactionResult` |
|
|
453
415
|
| `useTransaction()` | `transact({ ... })` | `TransactionResult` (custom tx) |
|
|
454
416
|
| `useExecuteProgram()` | `execute(...)` | program output |
|
|
455
417
|
| `useCompile()` | `compile({ source })` | `{ component, txScript, noteScript }` |
|
package/README.md
CHANGED
|
@@ -12,8 +12,6 @@ React hooks library for the Miden Web Client. Provides a simple, ergonomic inter
|
|
|
12
12
|
- **Note Attachments** - Send and read arbitrary data payloads on notes via `useSend()` and `readNoteAttachment()`
|
|
13
13
|
- **Temporal Note Tracking** - `useNoteStream()` tracks when notes first appear, with built-in filtering, handled-note exclusion, and phase snapshots
|
|
14
14
|
- **Session Wallets** - `useSessionAccount()` manages the create-fund-consume lifecycle for temporary wallets
|
|
15
|
-
- **AggLayer Bridge-Out** - `useBridge()` emits a B2AGG note to bridge a fungible asset out to another network via the AggLayer
|
|
16
|
-
- **Network Notes** - `useCreateNetworkNote()` creates custom-script network notes
|
|
17
15
|
- **Concurrency Safety** - Transaction hooks prevent double-sends with built-in concurrency guards
|
|
18
16
|
- **Auto Pre-Sync** - Transaction hooks sync before executing by default (opt out with `skipSync`)
|
|
19
17
|
- **WASM Error Wrapping** - Cryptic WASM errors are intercepted and replaced with actionable messages
|
|
@@ -1107,64 +1105,6 @@ function CancelPswapButton({ accountId, note }: Props) {
|
|
|
1107
1105
|
}
|
|
1108
1106
|
```
|
|
1109
1107
|
|
|
1110
|
-
#### `usePswapLineages()` / `usePswapLineagesFor()` / `usePswapLineage()`
|
|
1111
|
-
|
|
1112
|
-
Read the partial-swap orders this client is tracking. As a PSWAP note is filled
|
|
1113
|
-
round by round, the client follows the chain — original note → remainder →
|
|
1114
|
-
remainder — and records each step as a **lineage** keyed by a stable `orderId`.
|
|
1115
|
-
These query hooks expose that tracked state and refresh after every successful
|
|
1116
|
-
sync. They return `{ lineages | lineage, isLoading, error, refetch }`.
|
|
1117
|
-
|
|
1118
|
-
```tsx
|
|
1119
|
-
import {
|
|
1120
|
-
usePswapLineages,
|
|
1121
|
-
usePswapLineagesFor,
|
|
1122
|
-
usePswapLineage,
|
|
1123
|
-
} from '@miden-sdk/react';
|
|
1124
|
-
|
|
1125
|
-
// Every lineage tracked by this client
|
|
1126
|
-
const { lineages } = usePswapLineages();
|
|
1127
|
-
|
|
1128
|
-
// Only the lineages created by one account
|
|
1129
|
-
const { lineages: mine } = usePswapLineagesFor('0xmywallet...');
|
|
1130
|
-
|
|
1131
|
-
// A single order by its stable id
|
|
1132
|
-
const { lineage } = usePswapLineage(orderId);
|
|
1133
|
-
|
|
1134
|
-
function OrderRow({ orderId }: { orderId: string }) {
|
|
1135
|
-
const { lineage, isLoading } = usePswapLineage(orderId);
|
|
1136
|
-
if (isLoading) return <span>Loading…</span>;
|
|
1137
|
-
if (!lineage) return <span>Not tracked</span>;
|
|
1138
|
-
return (
|
|
1139
|
-
<span>
|
|
1140
|
-
{lineage.orderId()} — {lineage.remainingOffered().toString()} left,
|
|
1141
|
-
state {lineage.state()}
|
|
1142
|
-
</span>
|
|
1143
|
-
);
|
|
1144
|
-
}
|
|
1145
|
-
```
|
|
1146
|
-
|
|
1147
|
-
#### `usePswapCancelByOrder()`
|
|
1148
|
-
|
|
1149
|
-
Cancel a tracked PSWAP by its stable `orderId` and reclaim the unfilled offered
|
|
1150
|
-
asset on the lineage's current tip. Unlike `usePswapCancel`, you don't need to
|
|
1151
|
-
hold the tip note — the creator account and tip are resolved from the locally
|
|
1152
|
-
tracked lineage, so only the order id is required.
|
|
1153
|
-
|
|
1154
|
-
```tsx
|
|
1155
|
-
import { usePswapCancelByOrder } from '@miden-sdk/react';
|
|
1156
|
-
|
|
1157
|
-
function CancelOrderButton({ orderId }: { orderId: string }) {
|
|
1158
|
-
const { pswapCancelByOrder, isLoading, stage } = usePswapCancelByOrder();
|
|
1159
|
-
|
|
1160
|
-
return (
|
|
1161
|
-
<button onClick={() => pswapCancelByOrder({ orderId })} disabled={isLoading}>
|
|
1162
|
-
{isLoading ? stage : 'Cancel order'}
|
|
1163
|
-
</button>
|
|
1164
|
-
);
|
|
1165
|
-
}
|
|
1166
|
-
```
|
|
1167
|
-
|
|
1168
1108
|
#### `useTransaction()`
|
|
1169
1109
|
|
|
1170
1110
|
Execute a custom `TransactionRequest` or build one with the client. This is the
|
package/dist/index.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,
|
|
5
|
-
export { Account, AccountFile, AccountHeader, AccountId, AccountStorageMode, AuthScheme, ConsumableNoteRecord, InputNoteRecord, Note, NoteType,
|
|
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
|
|
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 };
|