@miden-sdk/react 0.14.4 → 0.15.0-alpha.4
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 +66 -47
- package/LICENSE +21 -0
- package/README.md +7 -7
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +150 -160
- package/dist/index.mjs +19 -31
- package/package.json +30 -35
- package/dist/lazy.d.mts +0 -1497
- package/dist/lazy.d.ts +0 -1497
- package/dist/lazy.js +0 -3672
- package/dist/lazy.mjs +0 -3637
package/dist/index.js
CHANGED
|
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
33
|
-
AuthScheme: () =>
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AuthScheme: () => import_miden_sdk4.AuthScheme,
|
|
34
34
|
DEFAULTS: () => DEFAULTS,
|
|
35
35
|
MidenError: () => MidenError,
|
|
36
36
|
MidenProvider: () => MidenProvider,
|
|
@@ -44,9 +44,11 @@ __export(src_exports, {
|
|
|
44
44
|
concatBytes: () => concatBytes,
|
|
45
45
|
createMidenStorage: () => createMidenStorage,
|
|
46
46
|
createNoteAttachment: () => createNoteAttachment,
|
|
47
|
+
ensureAccountBech32: () => ensureAccountBech32,
|
|
47
48
|
formatAssetAmount: () => formatAssetAmount,
|
|
48
49
|
formatNoteSummary: () => formatNoteSummary,
|
|
49
50
|
getNoteSummary: () => getNoteSummary,
|
|
51
|
+
installAccountBech32: () => installAccountBech32,
|
|
50
52
|
migrateStorage: () => migrateStorage,
|
|
51
53
|
normalizeAccountId: () => normalizeAccountId,
|
|
52
54
|
parseAssetAmount: () => parseAssetAmount,
|
|
@@ -85,13 +87,13 @@ __export(src_exports, {
|
|
|
85
87
|
waitForWalletDetection: () => waitForWalletDetection,
|
|
86
88
|
wrapWasmError: () => wrapWasmError
|
|
87
89
|
});
|
|
88
|
-
module.exports = __toCommonJS(
|
|
90
|
+
module.exports = __toCommonJS(index_exports);
|
|
89
91
|
|
|
90
92
|
// src/types/augmentations.ts
|
|
91
|
-
var
|
|
93
|
+
var import_miden_sdk = require("@miden-sdk/miden-sdk");
|
|
92
94
|
|
|
93
95
|
// src/utils/accountBech32.ts
|
|
94
|
-
var
|
|
96
|
+
var import_miden_sdk3 = require("@miden-sdk/miden-sdk");
|
|
95
97
|
|
|
96
98
|
// src/store/MidenStore.ts
|
|
97
99
|
var import_zustand = require("zustand");
|
|
@@ -238,19 +240,19 @@ var useAssetMetadataStore = () => useMidenStore((state) => state.assetMetadata);
|
|
|
238
240
|
var useNoteFirstSeenStore = () => useMidenStore((state) => state.noteFirstSeen);
|
|
239
241
|
|
|
240
242
|
// src/utils/accountParsing.ts
|
|
241
|
-
var
|
|
243
|
+
var import_miden_sdk2 = require("@miden-sdk/miden-sdk");
|
|
242
244
|
var normalizeAccountIdInput = (value) => value.trim().replace(/^miden:/i, "");
|
|
243
245
|
var isBech32Input = (value) => value.startsWith("m") || value.startsWith("M");
|
|
244
246
|
var normalizeHexInput = (value) => value.startsWith("0x") || value.startsWith("0X") ? value : `0x${value}`;
|
|
245
247
|
var parseAccountIdFromString = (value) => {
|
|
246
248
|
if (isBech32Input(value)) {
|
|
247
249
|
try {
|
|
248
|
-
return
|
|
250
|
+
return import_miden_sdk2.Address.fromBech32(value).accountId();
|
|
249
251
|
} catch {
|
|
250
|
-
return
|
|
252
|
+
return import_miden_sdk2.AccountId.fromBech32(value);
|
|
251
253
|
}
|
|
252
254
|
}
|
|
253
|
-
return
|
|
255
|
+
return import_miden_sdk2.AccountId.fromHex(normalizeHexInput(value));
|
|
254
256
|
};
|
|
255
257
|
var parseAccountId = (value) => {
|
|
256
258
|
if (typeof value === "string") {
|
|
@@ -277,49 +279,49 @@ function isFaucetId(accountId) {
|
|
|
277
279
|
var parseAddress = (value, accountId) => {
|
|
278
280
|
if (typeof value !== "string") {
|
|
279
281
|
const resolvedId = accountId ?? parseAccountId(value);
|
|
280
|
-
return
|
|
282
|
+
return import_miden_sdk2.Address.fromAccountId(resolvedId, "BasicWallet");
|
|
281
283
|
}
|
|
282
284
|
const normalized = normalizeAccountIdInput(value);
|
|
283
285
|
if (isBech32Input(normalized)) {
|
|
284
286
|
try {
|
|
285
|
-
return
|
|
287
|
+
return import_miden_sdk2.Address.fromBech32(normalized);
|
|
286
288
|
} catch {
|
|
287
|
-
const resolvedAccountId2 = accountId ??
|
|
288
|
-
return
|
|
289
|
+
const resolvedAccountId2 = accountId ?? import_miden_sdk2.AccountId.fromBech32(normalized);
|
|
290
|
+
return import_miden_sdk2.Address.fromAccountId(resolvedAccountId2, "BasicWallet");
|
|
289
291
|
}
|
|
290
292
|
}
|
|
291
|
-
const resolvedAccountId = accountId ??
|
|
292
|
-
return
|
|
293
|
+
const resolvedAccountId = accountId ?? import_miden_sdk2.AccountId.fromHex(normalizeHexInput(normalized));
|
|
294
|
+
return import_miden_sdk2.Address.fromAccountId(resolvedAccountId, "BasicWallet");
|
|
293
295
|
};
|
|
294
296
|
|
|
295
297
|
// src/utils/accountBech32.ts
|
|
296
298
|
var inferNetworkId = () => {
|
|
297
299
|
const { rpcUrl } = useMidenStore.getState().config;
|
|
298
300
|
if (!rpcUrl) {
|
|
299
|
-
return
|
|
301
|
+
return import_miden_sdk3.NetworkId.testnet();
|
|
300
302
|
}
|
|
301
303
|
const url = rpcUrl.toLowerCase();
|
|
302
304
|
if (url.includes("devnet") || url.includes("mdev")) {
|
|
303
|
-
return
|
|
305
|
+
return import_miden_sdk3.NetworkId.devnet();
|
|
304
306
|
}
|
|
305
307
|
if (url.includes("mainnet")) {
|
|
306
|
-
return
|
|
308
|
+
return import_miden_sdk3.NetworkId.mainnet();
|
|
307
309
|
}
|
|
308
310
|
if (url.includes("testnet") || url.includes("mtst")) {
|
|
309
|
-
return
|
|
311
|
+
return import_miden_sdk3.NetworkId.testnet();
|
|
310
312
|
}
|
|
311
|
-
return
|
|
313
|
+
return import_miden_sdk3.NetworkId.testnet();
|
|
312
314
|
};
|
|
313
315
|
var toBech32FromAccountId = (id) => {
|
|
314
316
|
try {
|
|
315
|
-
const address =
|
|
317
|
+
const address = import_miden_sdk3.Address.fromAccountId(id, "BasicWallet");
|
|
316
318
|
return address.toBech32(inferNetworkId());
|
|
317
319
|
} catch {
|
|
318
320
|
}
|
|
319
321
|
try {
|
|
320
322
|
const maybeBech32 = id.toBech32?.(
|
|
321
323
|
inferNetworkId(),
|
|
322
|
-
|
|
324
|
+
import_miden_sdk3.AccountInterface.BasicWallet
|
|
323
325
|
);
|
|
324
326
|
if (typeof maybeBech32 === "string") {
|
|
325
327
|
return maybeBech32;
|
|
@@ -349,7 +351,7 @@ var defineBech32 = (target) => {
|
|
|
349
351
|
}
|
|
350
352
|
};
|
|
351
353
|
var installAccountBech32 = () => {
|
|
352
|
-
const proto =
|
|
354
|
+
const proto = import_miden_sdk3.Account.prototype;
|
|
353
355
|
if (proto.bech32id) {
|
|
354
356
|
return;
|
|
355
357
|
}
|
|
@@ -382,17 +384,17 @@ var toBech32AccountId = (accountId) => {
|
|
|
382
384
|
|
|
383
385
|
// src/context/MidenProvider.tsx
|
|
384
386
|
var import_react2 = require("react");
|
|
385
|
-
var
|
|
387
|
+
var import_miden_sdk6 = require("@miden-sdk/miden-sdk");
|
|
386
388
|
|
|
387
389
|
// src/types/index.ts
|
|
388
|
-
var
|
|
390
|
+
var import_miden_sdk4 = require("@miden-sdk/miden-sdk");
|
|
389
391
|
var DEFAULTS = {
|
|
390
392
|
RPC_URL: void 0,
|
|
391
393
|
// Will use SDK's testnet default
|
|
392
394
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
393
395
|
STORAGE_MODE: "private",
|
|
394
396
|
WALLET_MUTABLE: true,
|
|
395
|
-
AUTH_SCHEME:
|
|
397
|
+
AUTH_SCHEME: import_miden_sdk4.AuthScheme.AuthRpoFalcon512,
|
|
396
398
|
NOTE_TYPE: "private",
|
|
397
399
|
FAUCET_DECIMALS: 8
|
|
398
400
|
};
|
|
@@ -436,7 +438,7 @@ function resolveRpcUrl(rpcUrl) {
|
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
// src/utils/prover.ts
|
|
439
|
-
var
|
|
441
|
+
var import_miden_sdk5 = require("@miden-sdk/miden-sdk");
|
|
440
442
|
var DEFAULT_PROVER_URLS = {
|
|
441
443
|
devnet: "https://tx-prover.devnet.miden.io",
|
|
442
444
|
testnet: "https://tx-prover.testnet.miden.io"
|
|
@@ -475,19 +477,16 @@ function resolveProverTarget(target, config) {
|
|
|
475
477
|
if (typeof target === "string") {
|
|
476
478
|
const normalized = target.trim().toLowerCase();
|
|
477
479
|
if (normalized === "local" || normalized === "localhost") {
|
|
478
|
-
return
|
|
480
|
+
return import_miden_sdk5.TransactionProver.newLocalProver();
|
|
479
481
|
}
|
|
480
482
|
if (normalized === "devnet" || normalized === "testnet") {
|
|
481
|
-
const url = config.proverUrls?.[normalized] ?? DEFAULT_PROVER_URLS[normalized]
|
|
482
|
-
|
|
483
|
-
throw new Error(`Missing ${normalized} prover URL`);
|
|
484
|
-
}
|
|
485
|
-
return import_lazy5.TransactionProver.newRemoteProver(
|
|
483
|
+
const url = config.proverUrls?.[normalized] ?? DEFAULT_PROVER_URLS[normalized];
|
|
484
|
+
return import_miden_sdk5.TransactionProver.newRemoteProver(
|
|
486
485
|
url,
|
|
487
486
|
normalizeTimeout(config.proverTimeoutMs)
|
|
488
487
|
);
|
|
489
488
|
}
|
|
490
|
-
return
|
|
489
|
+
return import_miden_sdk5.TransactionProver.newRemoteProver(
|
|
491
490
|
target,
|
|
492
491
|
normalizeTimeout(config.proverTimeoutMs)
|
|
493
492
|
);
|
|
@@ -499,7 +498,7 @@ function createRemoteProver(config, fallbackTimeout) {
|
|
|
499
498
|
if (!url) {
|
|
500
499
|
throw new Error("Remote prover requires a URL");
|
|
501
500
|
}
|
|
502
|
-
return
|
|
501
|
+
return import_miden_sdk5.TransactionProver.newRemoteProver(
|
|
503
502
|
url,
|
|
504
503
|
normalizeTimeout(timeoutMs ?? fallbackTimeout)
|
|
505
504
|
);
|
|
@@ -629,20 +628,15 @@ function MidenProvider({
|
|
|
629
628
|
}),
|
|
630
629
|
[config]
|
|
631
630
|
);
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
resolvedConfig.prover,
|
|
642
|
-
resolvedConfig.proverTimeoutMs,
|
|
643
|
-
resolvedConfig.proverUrls?.devnet,
|
|
644
|
-
resolvedConfig.proverUrls?.testnet
|
|
645
|
-
]);
|
|
631
|
+
const defaultProver = (0, import_react2.useMemo)(
|
|
632
|
+
() => resolveTransactionProver(resolvedConfig),
|
|
633
|
+
[
|
|
634
|
+
resolvedConfig.prover,
|
|
635
|
+
resolvedConfig.proverTimeoutMs,
|
|
636
|
+
resolvedConfig.proverUrls?.devnet,
|
|
637
|
+
resolvedConfig.proverUrls?.testnet
|
|
638
|
+
]
|
|
639
|
+
);
|
|
646
640
|
const runExclusive = (0, import_react2.useCallback)(
|
|
647
641
|
async (fn) => clientLockRef.current.runExclusive(fn),
|
|
648
642
|
[]
|
|
@@ -721,7 +715,7 @@ function MidenProvider({
|
|
|
721
715
|
if (signerContext && signerIsConnected === true) {
|
|
722
716
|
const storeName = `MidenClientDB_${signerContext.storeName}`;
|
|
723
717
|
signCbRef.current = signerContext.signCb;
|
|
724
|
-
webClient = await
|
|
718
|
+
webClient = await import_miden_sdk6.WasmWebClient.createClientWithExternalKeystore(
|
|
725
719
|
resolvedConfig.rpcUrl,
|
|
726
720
|
resolvedConfig.noteTransportUrl,
|
|
727
721
|
resolvedConfig.seed,
|
|
@@ -741,7 +735,7 @@ function MidenProvider({
|
|
|
741
735
|
currentStoreNameRef.current = signerContext.storeName;
|
|
742
736
|
} else {
|
|
743
737
|
const seed = resolvedConfig.seed;
|
|
744
|
-
webClient = await
|
|
738
|
+
webClient = await import_miden_sdk6.WasmWebClient.createClient(
|
|
745
739
|
resolvedConfig.rpcUrl,
|
|
746
740
|
resolvedConfig.noteTransportUrl,
|
|
747
741
|
seed
|
|
@@ -1085,7 +1079,7 @@ var import_react6 = require("react");
|
|
|
1085
1079
|
|
|
1086
1080
|
// src/hooks/useAssetMetadata.ts
|
|
1087
1081
|
var import_react5 = require("react");
|
|
1088
|
-
var
|
|
1082
|
+
var import_miden_sdk7 = require("@miden-sdk/miden-sdk");
|
|
1089
1083
|
var inflight = /* @__PURE__ */ new Map();
|
|
1090
1084
|
var rpcClients = /* @__PURE__ */ new Map();
|
|
1091
1085
|
var getRpcClient = (rpcUrl) => {
|
|
@@ -1093,8 +1087,8 @@ var getRpcClient = (rpcUrl) => {
|
|
|
1093
1087
|
const existing = rpcClients.get(key);
|
|
1094
1088
|
if (existing) return existing;
|
|
1095
1089
|
try {
|
|
1096
|
-
const endpoint = rpcUrl ? new
|
|
1097
|
-
const client = new
|
|
1090
|
+
const endpoint = rpcUrl ? new import_miden_sdk7.Endpoint(rpcUrl) : import_miden_sdk7.Endpoint.testnet();
|
|
1091
|
+
const client = new import_miden_sdk7.RpcClient(endpoint);
|
|
1098
1092
|
rpcClients.set(key, client);
|
|
1099
1093
|
return client;
|
|
1100
1094
|
} catch {
|
|
@@ -1108,7 +1102,7 @@ var fetchAssetMetadata = async (rpcClient, assetId) => {
|
|
|
1108
1102
|
const fetched = await rpcClient.getAccountDetails(accountId);
|
|
1109
1103
|
const account = fetched.account?.();
|
|
1110
1104
|
if (!account) return null;
|
|
1111
|
-
const faucet =
|
|
1105
|
+
const faucet = import_miden_sdk7.BasicFungibleFaucetComponent.fromAccount(account);
|
|
1112
1106
|
const symbol = faucet.symbol().toString();
|
|
1113
1107
|
const decimals = faucet.decimals();
|
|
1114
1108
|
return { assetId, symbol, decimals };
|
|
@@ -1234,7 +1228,7 @@ function useAccount(accountId) {
|
|
|
1234
1228
|
|
|
1235
1229
|
// src/hooks/useNotes.ts
|
|
1236
1230
|
var import_react7 = require("react");
|
|
1237
|
-
var
|
|
1231
|
+
var import_miden_sdk9 = require("@miden-sdk/miden-sdk");
|
|
1238
1232
|
|
|
1239
1233
|
// src/utils/amounts.ts
|
|
1240
1234
|
var formatAssetAmount = (amount, decimals) => {
|
|
@@ -1339,30 +1333,30 @@ function accountIdsEqual(a, b) {
|
|
|
1339
1333
|
}
|
|
1340
1334
|
|
|
1341
1335
|
// src/utils/noteFilters.ts
|
|
1342
|
-
var
|
|
1336
|
+
var import_miden_sdk8 = require("@miden-sdk/miden-sdk");
|
|
1343
1337
|
function getNoteFilterType(status) {
|
|
1344
1338
|
switch (status) {
|
|
1345
1339
|
case "consumed":
|
|
1346
|
-
return
|
|
1340
|
+
return import_miden_sdk8.NoteFilterTypes.Consumed;
|
|
1347
1341
|
case "committed":
|
|
1348
|
-
return
|
|
1342
|
+
return import_miden_sdk8.NoteFilterTypes.Committed;
|
|
1349
1343
|
case "expected":
|
|
1350
|
-
return
|
|
1344
|
+
return import_miden_sdk8.NoteFilterTypes.Expected;
|
|
1351
1345
|
case "processing":
|
|
1352
|
-
return
|
|
1346
|
+
return import_miden_sdk8.NoteFilterTypes.Processing;
|
|
1353
1347
|
case "all":
|
|
1354
1348
|
default:
|
|
1355
|
-
return
|
|
1349
|
+
return import_miden_sdk8.NoteFilterTypes.All;
|
|
1356
1350
|
}
|
|
1357
1351
|
}
|
|
1358
1352
|
function getNoteType(type) {
|
|
1359
1353
|
switch (type) {
|
|
1360
1354
|
case "private":
|
|
1361
|
-
return
|
|
1355
|
+
return import_miden_sdk8.NoteType.Private;
|
|
1362
1356
|
case "public":
|
|
1363
|
-
return
|
|
1357
|
+
return import_miden_sdk8.NoteType.Public;
|
|
1364
1358
|
default:
|
|
1365
|
-
return
|
|
1359
|
+
return import_miden_sdk8.NoteType.Private;
|
|
1366
1360
|
}
|
|
1367
1361
|
}
|
|
1368
1362
|
async function waitForTransactionCommit(client, runExclusiveSafe, txIdHex, maxWaitMs = 1e4, delayMs = 1e3) {
|
|
@@ -1371,7 +1365,7 @@ async function waitForTransactionCommit(client, runExclusiveSafe, txIdHex, maxWa
|
|
|
1371
1365
|
while (Date.now() < deadline) {
|
|
1372
1366
|
await runExclusiveSafe(() => client.syncState());
|
|
1373
1367
|
const records = await runExclusiveSafe(
|
|
1374
|
-
() => client.getTransactions(
|
|
1368
|
+
() => client.getTransactions(import_miden_sdk8.TransactionFilter.all())
|
|
1375
1369
|
);
|
|
1376
1370
|
const record = records.find(
|
|
1377
1371
|
(r) => normalizeHex(r.id().toHex()) === targetHex
|
|
@@ -1414,7 +1408,7 @@ function useNotes(options) {
|
|
|
1414
1408
|
setError(null);
|
|
1415
1409
|
try {
|
|
1416
1410
|
const filterType = getNoteFilterType(options?.status);
|
|
1417
|
-
const filter = new
|
|
1411
|
+
const filter = new import_miden_sdk9.NoteFilter(filterType);
|
|
1418
1412
|
const fetchedNotes = await client.getInputNotes(filter);
|
|
1419
1413
|
let fetchedConsumable;
|
|
1420
1414
|
if (options?.accountId) {
|
|
@@ -1536,10 +1530,10 @@ function useNotes(options) {
|
|
|
1536
1530
|
|
|
1537
1531
|
// src/hooks/useNoteStream.ts
|
|
1538
1532
|
var import_react8 = require("react");
|
|
1539
|
-
var
|
|
1533
|
+
var import_miden_sdk11 = require("@miden-sdk/miden-sdk");
|
|
1540
1534
|
|
|
1541
1535
|
// src/utils/noteAttachment.ts
|
|
1542
|
-
var
|
|
1536
|
+
var import_miden_sdk10 = require("@miden-sdk/miden-sdk");
|
|
1543
1537
|
function readNoteAttachment(note) {
|
|
1544
1538
|
try {
|
|
1545
1539
|
const metadata = note.metadata?.();
|
|
@@ -1548,8 +1542,8 @@ function readNoteAttachment(note) {
|
|
|
1548
1542
|
if (!attachment) return null;
|
|
1549
1543
|
const kind = attachment.kind?.();
|
|
1550
1544
|
if (!kind) return null;
|
|
1551
|
-
if (kind ===
|
|
1552
|
-
if (kind ===
|
|
1545
|
+
if (kind === import_miden_sdk10.NoteAttachmentKind.None) return null;
|
|
1546
|
+
if (kind === import_miden_sdk10.NoteAttachmentKind.Word) {
|
|
1553
1547
|
const word = attachment.asWord?.();
|
|
1554
1548
|
if (!word) return null;
|
|
1555
1549
|
const u64s = word.toU64s();
|
|
@@ -1558,7 +1552,7 @@ function readNoteAttachment(note) {
|
|
|
1558
1552
|
);
|
|
1559
1553
|
return { values, kind: "word" };
|
|
1560
1554
|
}
|
|
1561
|
-
if (kind ===
|
|
1555
|
+
if (kind === import_miden_sdk10.NoteAttachmentKind.Array) {
|
|
1562
1556
|
const arr = attachment.asArray?.();
|
|
1563
1557
|
if (!arr) return null;
|
|
1564
1558
|
const u64s = arr.toU64s();
|
|
@@ -1578,30 +1572,30 @@ function createNoteAttachment(values) {
|
|
|
1578
1572
|
bigints.push(BigInt(values[i]));
|
|
1579
1573
|
}
|
|
1580
1574
|
if (bigints.length === 0) {
|
|
1581
|
-
return new
|
|
1575
|
+
return new import_miden_sdk10.NoteAttachment();
|
|
1582
1576
|
}
|
|
1583
|
-
const scheme =
|
|
1577
|
+
const scheme = import_miden_sdk10.NoteAttachmentScheme.none();
|
|
1584
1578
|
if (bigints.length <= 4) {
|
|
1585
1579
|
while (bigints.length < 4) {
|
|
1586
1580
|
bigints.push(0n);
|
|
1587
1581
|
}
|
|
1588
|
-
const word = new
|
|
1589
|
-
return
|
|
1582
|
+
const word = new import_miden_sdk10.Word(BigUint64Array.from(bigints));
|
|
1583
|
+
return import_miden_sdk10.NoteAttachment.newWord(scheme, word);
|
|
1590
1584
|
}
|
|
1591
1585
|
while (bigints.length % 4 !== 0) {
|
|
1592
1586
|
bigints.push(0n);
|
|
1593
1587
|
}
|
|
1594
1588
|
const words = [];
|
|
1595
1589
|
for (let i = 0; i < bigints.length; i += 4) {
|
|
1596
|
-
words.push(new
|
|
1590
|
+
words.push(new import_miden_sdk10.Word(BigUint64Array.from(bigints.slice(i, i + 4))));
|
|
1597
1591
|
}
|
|
1598
|
-
const newArray =
|
|
1592
|
+
const newArray = import_miden_sdk10.NoteAttachment["newArray"];
|
|
1599
1593
|
if (typeof newArray !== "function") {
|
|
1600
1594
|
throw new Error(
|
|
1601
1595
|
"NoteAttachment.newArray is not available. Ensure @miden-sdk/miden-sdk >= 0.13.1."
|
|
1602
1596
|
);
|
|
1603
1597
|
}
|
|
1604
|
-
return newArray.call(
|
|
1598
|
+
return newArray.call(import_miden_sdk10.NoteAttachment, scheme, words);
|
|
1605
1599
|
}
|
|
1606
1600
|
|
|
1607
1601
|
// src/hooks/useNoteStream.ts
|
|
@@ -1636,7 +1630,7 @@ function useNoteStream(options = {}) {
|
|
|
1636
1630
|
setError(null);
|
|
1637
1631
|
try {
|
|
1638
1632
|
const filterType = getNoteFilterType(status);
|
|
1639
|
-
const filter = new
|
|
1633
|
+
const filter = new import_miden_sdk11.NoteFilter(filterType);
|
|
1640
1634
|
const fetched = await client.getInputNotes(filter);
|
|
1641
1635
|
setNotesIfChanged(fetched);
|
|
1642
1636
|
} catch (err) {
|
|
@@ -1748,7 +1742,7 @@ function buildStreamedNote(record, noteFirstSeen) {
|
|
|
1748
1742
|
|
|
1749
1743
|
// src/hooks/useTransactionHistory.ts
|
|
1750
1744
|
var import_react9 = require("react");
|
|
1751
|
-
var
|
|
1745
|
+
var import_miden_sdk12 = require("@miden-sdk/miden-sdk");
|
|
1752
1746
|
function useTransactionHistory(options = {}) {
|
|
1753
1747
|
const { client, isReady } = useMiden();
|
|
1754
1748
|
const { lastSyncTime } = useSyncStateStore();
|
|
@@ -1823,14 +1817,14 @@ function buildFilter(filter, ids, idsHex) {
|
|
|
1823
1817
|
return { filter };
|
|
1824
1818
|
}
|
|
1825
1819
|
if (!ids || ids.length === 0) {
|
|
1826
|
-
return { filter:
|
|
1820
|
+
return { filter: import_miden_sdk12.TransactionFilter.all() };
|
|
1827
1821
|
}
|
|
1828
1822
|
const allTransactionIds = ids.every((id) => typeof id !== "string");
|
|
1829
1823
|
if (allTransactionIds) {
|
|
1830
|
-
return { filter:
|
|
1824
|
+
return { filter: import_miden_sdk12.TransactionFilter.ids(ids) };
|
|
1831
1825
|
}
|
|
1832
1826
|
return {
|
|
1833
|
-
filter:
|
|
1827
|
+
filter: import_miden_sdk12.TransactionFilter.all(),
|
|
1834
1828
|
localFilterHexes: idsHex ?? []
|
|
1835
1829
|
};
|
|
1836
1830
|
}
|
|
@@ -1856,7 +1850,7 @@ function useSyncState() {
|
|
|
1856
1850
|
|
|
1857
1851
|
// src/hooks/useCreateWallet.ts
|
|
1858
1852
|
var import_react11 = require("react");
|
|
1859
|
-
var
|
|
1853
|
+
var import_miden_sdk13 = require("@miden-sdk/miden-sdk");
|
|
1860
1854
|
|
|
1861
1855
|
// src/utils/runExclusive.ts
|
|
1862
1856
|
var runExclusiveDirect = async (fn) => fn();
|
|
@@ -1922,19 +1916,19 @@ function useCreateWallet() {
|
|
|
1922
1916
|
function getStorageMode(mode) {
|
|
1923
1917
|
switch (mode) {
|
|
1924
1918
|
case "private":
|
|
1925
|
-
return
|
|
1919
|
+
return import_miden_sdk13.AccountStorageMode.private();
|
|
1926
1920
|
case "public":
|
|
1927
|
-
return
|
|
1921
|
+
return import_miden_sdk13.AccountStorageMode.public();
|
|
1928
1922
|
case "network":
|
|
1929
|
-
return
|
|
1923
|
+
return import_miden_sdk13.AccountStorageMode.network();
|
|
1930
1924
|
default:
|
|
1931
|
-
return
|
|
1925
|
+
return import_miden_sdk13.AccountStorageMode.private();
|
|
1932
1926
|
}
|
|
1933
1927
|
}
|
|
1934
1928
|
|
|
1935
1929
|
// src/hooks/useCreateFaucet.ts
|
|
1936
1930
|
var import_react12 = require("react");
|
|
1937
|
-
var
|
|
1931
|
+
var import_miden_sdk14 = require("@miden-sdk/miden-sdk");
|
|
1938
1932
|
function useCreateFaucet() {
|
|
1939
1933
|
const { client, isReady, runExclusive } = useMiden();
|
|
1940
1934
|
const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
|
|
@@ -1997,19 +1991,19 @@ function useCreateFaucet() {
|
|
|
1997
1991
|
function getStorageMode2(mode) {
|
|
1998
1992
|
switch (mode) {
|
|
1999
1993
|
case "private":
|
|
2000
|
-
return
|
|
1994
|
+
return import_miden_sdk14.AccountStorageMode.private();
|
|
2001
1995
|
case "public":
|
|
2002
|
-
return
|
|
1996
|
+
return import_miden_sdk14.AccountStorageMode.public();
|
|
2003
1997
|
case "network":
|
|
2004
|
-
return
|
|
1998
|
+
return import_miden_sdk14.AccountStorageMode.network();
|
|
2005
1999
|
default:
|
|
2006
|
-
return
|
|
2000
|
+
return import_miden_sdk14.AccountStorageMode.private();
|
|
2007
2001
|
}
|
|
2008
2002
|
}
|
|
2009
2003
|
|
|
2010
2004
|
// src/hooks/useImportAccount.ts
|
|
2011
2005
|
var import_react13 = require("react");
|
|
2012
|
-
var
|
|
2006
|
+
var import_miden_sdk15 = require("@miden-sdk/miden-sdk");
|
|
2013
2007
|
|
|
2014
2008
|
// src/utils/errors.ts
|
|
2015
2009
|
var MidenError = class extends Error {
|
|
@@ -2181,10 +2175,10 @@ function useImportAccount() {
|
|
|
2181
2175
|
}
|
|
2182
2176
|
async function resolveAccountFile(file) {
|
|
2183
2177
|
if (file instanceof Uint8Array) {
|
|
2184
|
-
return
|
|
2178
|
+
return import_miden_sdk15.AccountFile.deserialize(file);
|
|
2185
2179
|
}
|
|
2186
2180
|
if (file instanceof ArrayBuffer) {
|
|
2187
|
-
return
|
|
2181
|
+
return import_miden_sdk15.AccountFile.deserialize(new Uint8Array(file));
|
|
2188
2182
|
}
|
|
2189
2183
|
return file;
|
|
2190
2184
|
}
|
|
@@ -2214,7 +2208,7 @@ function bytesEqual(left, right) {
|
|
|
2214
2208
|
|
|
2215
2209
|
// src/hooks/useSend.ts
|
|
2216
2210
|
var import_react14 = require("react");
|
|
2217
|
-
var
|
|
2211
|
+
var import_miden_sdk16 = require("@miden-sdk/miden-sdk");
|
|
2218
2212
|
function useSend() {
|
|
2219
2213
|
const { client, isReady, sync, runExclusive, prover } = useMiden();
|
|
2220
2214
|
const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
|
|
@@ -2281,19 +2275,19 @@ function useSend() {
|
|
|
2281
2275
|
const fromId = parseAccountId(options.from);
|
|
2282
2276
|
const toId = parseAccountId(options.to);
|
|
2283
2277
|
const assetObj = parseAccountId(assetId);
|
|
2284
|
-
const assets = new
|
|
2285
|
-
new
|
|
2278
|
+
const assets = new import_miden_sdk16.NoteAssets([
|
|
2279
|
+
new import_miden_sdk16.FungibleAsset(assetObj, BigInt(amount))
|
|
2286
2280
|
]);
|
|
2287
|
-
const p2idNote =
|
|
2281
|
+
const p2idNote = import_miden_sdk16.Note.createP2IDNote(
|
|
2288
2282
|
fromId,
|
|
2289
2283
|
toId,
|
|
2290
2284
|
assets,
|
|
2291
2285
|
noteType,
|
|
2292
|
-
new
|
|
2286
|
+
new import_miden_sdk16.NoteAttachment()
|
|
2293
2287
|
);
|
|
2294
|
-
const ownOutputs = new
|
|
2288
|
+
const ownOutputs = new import_miden_sdk16.NoteArray();
|
|
2295
2289
|
ownOutputs.push(p2idNote);
|
|
2296
|
-
const txRequest = new
|
|
2290
|
+
const txRequest = new import_miden_sdk16.TransactionRequestBuilder().withOwnOutputNotes(ownOutputs).build();
|
|
2297
2291
|
const execFromId = parseAccountId(options.from);
|
|
2298
2292
|
const txId = prover ? await client.submitNewTransactionWithProver(
|
|
2299
2293
|
execFromId,
|
|
@@ -2314,19 +2308,19 @@ function useSend() {
|
|
|
2314
2308
|
let txRequest;
|
|
2315
2309
|
if (hasAttachment) {
|
|
2316
2310
|
const attachment = createNoteAttachment(options.attachment);
|
|
2317
|
-
const assets = new
|
|
2318
|
-
new
|
|
2311
|
+
const assets = new import_miden_sdk16.NoteAssets([
|
|
2312
|
+
new import_miden_sdk16.FungibleAsset(assetIdObj, amount)
|
|
2319
2313
|
]);
|
|
2320
|
-
const note =
|
|
2314
|
+
const note = import_miden_sdk16.Note.createP2IDNote(
|
|
2321
2315
|
fromAccountId,
|
|
2322
2316
|
toAccountId,
|
|
2323
2317
|
assets,
|
|
2324
2318
|
noteType,
|
|
2325
2319
|
attachment
|
|
2326
2320
|
);
|
|
2327
|
-
txRequest = new
|
|
2321
|
+
txRequest = new import_miden_sdk16.TransactionRequestBuilder().withOwnOutputNotes(new import_miden_sdk16.NoteArray([note])).build();
|
|
2328
2322
|
} else {
|
|
2329
|
-
txRequest = client.newSendTransactionRequest(
|
|
2323
|
+
txRequest = await client.newSendTransactionRequest(
|
|
2330
2324
|
fromAccountId,
|
|
2331
2325
|
toAccountId,
|
|
2332
2326
|
assetIdObj,
|
|
@@ -2343,7 +2337,7 @@ function useSend() {
|
|
|
2343
2337
|
const proverConfig = useMidenStore.getState().config;
|
|
2344
2338
|
const provenTransaction = await proveWithFallback(
|
|
2345
2339
|
(resolvedProver) => runExclusiveSafe(
|
|
2346
|
-
() =>
|
|
2340
|
+
() => client.proveTransaction(txResult, resolvedProver)
|
|
2347
2341
|
),
|
|
2348
2342
|
proverConfig
|
|
2349
2343
|
);
|
|
@@ -2354,13 +2348,13 @@ function useSend() {
|
|
|
2354
2348
|
const txIdHex = txResult.id().toHex();
|
|
2355
2349
|
const txIdString = txResult.id().toString();
|
|
2356
2350
|
let fullNote = null;
|
|
2357
|
-
if (noteType ===
|
|
2351
|
+
if (noteType === import_miden_sdk16.NoteType.Private) {
|
|
2358
2352
|
fullNote = extractFullNote(txResult);
|
|
2359
2353
|
}
|
|
2360
2354
|
await runExclusiveSafe(
|
|
2361
2355
|
() => client.applyTransaction(txResult, submissionHeight)
|
|
2362
2356
|
);
|
|
2363
|
-
if (noteType ===
|
|
2357
|
+
if (noteType === import_miden_sdk16.NoteType.Private) {
|
|
2364
2358
|
if (!fullNote) {
|
|
2365
2359
|
throw new Error("Missing full note for private send");
|
|
2366
2360
|
}
|
|
@@ -2423,7 +2417,7 @@ function extractFullNote(txResult) {
|
|
|
2423
2417
|
|
|
2424
2418
|
// src/hooks/useMultiSend.ts
|
|
2425
2419
|
var import_react15 = require("react");
|
|
2426
|
-
var
|
|
2420
|
+
var import_miden_sdk17 = require("@miden-sdk/miden-sdk");
|
|
2427
2421
|
function useMultiSend() {
|
|
2428
2422
|
const { client, isReady, sync, prover, signerConnected } = useMiden();
|
|
2429
2423
|
const isBusyRef = (0, import_react15.useRef)(false);
|
|
@@ -2460,12 +2454,12 @@ function useMultiSend() {
|
|
|
2460
2454
|
const iterSenderId = parseAccountId(options.from);
|
|
2461
2455
|
const iterAssetId = parseAccountId(options.assetId);
|
|
2462
2456
|
const receiverId = parseAccountId(to);
|
|
2463
|
-
const assets = new
|
|
2464
|
-
new
|
|
2457
|
+
const assets = new import_miden_sdk17.NoteAssets([
|
|
2458
|
+
new import_miden_sdk17.FungibleAsset(iterAssetId, BigInt(amount))
|
|
2465
2459
|
]);
|
|
2466
2460
|
const resolvedNoteType = recipientNoteType ? getNoteType(recipientNoteType) : noteType;
|
|
2467
|
-
const noteAttachment = attachment !== void 0 && attachment !== null ? createNoteAttachment(attachment) : new
|
|
2468
|
-
const note =
|
|
2461
|
+
const noteAttachment = attachment !== void 0 && attachment !== null ? createNoteAttachment(attachment) : new import_miden_sdk17.NoteAttachment();
|
|
2462
|
+
const note = import_miden_sdk17.Note.createP2IDNote(
|
|
2469
2463
|
iterSenderId,
|
|
2470
2464
|
receiverId,
|
|
2471
2465
|
assets,
|
|
@@ -2480,14 +2474,14 @@ function useMultiSend() {
|
|
|
2480
2474
|
};
|
|
2481
2475
|
}
|
|
2482
2476
|
);
|
|
2483
|
-
const txRequest = new
|
|
2477
|
+
const txRequest = new import_miden_sdk17.TransactionRequestBuilder().withOwnOutputNotes(new import_miden_sdk17.NoteArray(outputs.map((o) => o.note))).build();
|
|
2484
2478
|
const txSenderId = parseAccountId(options.from);
|
|
2485
2479
|
const txResult = await client.executeTransaction(txSenderId, txRequest);
|
|
2486
2480
|
setStage("proving");
|
|
2487
2481
|
const proverConfig = useMidenStore.getState().config;
|
|
2488
2482
|
const provenTransaction = await proveWithFallback(
|
|
2489
2483
|
(resolvedProver) => runExclusiveDirect(
|
|
2490
|
-
() =>
|
|
2484
|
+
() => client.proveTransaction(txResult, resolvedProver)
|
|
2491
2485
|
),
|
|
2492
2486
|
proverConfig
|
|
2493
2487
|
);
|
|
@@ -2499,7 +2493,7 @@ function useMultiSend() {
|
|
|
2499
2493
|
const txIdHex = txResult.id().toHex();
|
|
2500
2494
|
const txIdString = txResult.id().toString();
|
|
2501
2495
|
await client.applyTransaction(txResult, submissionHeight);
|
|
2502
|
-
const hasPrivate = outputs.some((o) => o.noteType ===
|
|
2496
|
+
const hasPrivate = outputs.some((o) => o.noteType === import_miden_sdk17.NoteType.Private);
|
|
2503
2497
|
if (hasPrivate) {
|
|
2504
2498
|
await waitForTransactionCommit(
|
|
2505
2499
|
client,
|
|
@@ -2507,7 +2501,7 @@ function useMultiSend() {
|
|
|
2507
2501
|
txIdHex
|
|
2508
2502
|
);
|
|
2509
2503
|
for (const output of outputs) {
|
|
2510
|
-
if (output.noteType ===
|
|
2504
|
+
if (output.noteType === import_miden_sdk17.NoteType.Private) {
|
|
2511
2505
|
await client.sendPrivateNote(
|
|
2512
2506
|
output.note,
|
|
2513
2507
|
output.recipientAddress
|
|
@@ -2550,7 +2544,7 @@ function useMultiSend() {
|
|
|
2550
2544
|
|
|
2551
2545
|
// src/hooks/useWaitForCommit.ts
|
|
2552
2546
|
var import_react16 = require("react");
|
|
2553
|
-
var
|
|
2547
|
+
var import_miden_sdk18 = require("@miden-sdk/miden-sdk");
|
|
2554
2548
|
function useWaitForCommit() {
|
|
2555
2549
|
const { client, isReady } = useMiden();
|
|
2556
2550
|
const waitForCommit = (0, import_react16.useCallback)(
|
|
@@ -2567,7 +2561,7 @@ function useWaitForCommit() {
|
|
|
2567
2561
|
while (Date.now() < deadline) {
|
|
2568
2562
|
await client.syncState();
|
|
2569
2563
|
const records = await client.getTransactions(
|
|
2570
|
-
typeof txId === "string" ?
|
|
2564
|
+
typeof txId === "string" ? import_miden_sdk18.TransactionFilter.all() : import_miden_sdk18.TransactionFilter.ids([txId])
|
|
2571
2565
|
);
|
|
2572
2566
|
const record = records.find(
|
|
2573
2567
|
(item) => normalizeHex3(item.id().toHex()) === targetHex
|
|
@@ -2653,7 +2647,7 @@ function useMint() {
|
|
|
2653
2647
|
const faucetIdObj = parseAccountId(options.faucetId);
|
|
2654
2648
|
setStage("proving");
|
|
2655
2649
|
const txResult = await runExclusiveSafe(async () => {
|
|
2656
|
-
const txRequest = client.newMintTransactionRequest(
|
|
2650
|
+
const txRequest = await client.newMintTransactionRequest(
|
|
2657
2651
|
targetAccountIdObj,
|
|
2658
2652
|
faucetIdObj,
|
|
2659
2653
|
noteType,
|
|
@@ -2699,7 +2693,7 @@ function useMint() {
|
|
|
2699
2693
|
|
|
2700
2694
|
// src/hooks/useConsume.ts
|
|
2701
2695
|
var import_react19 = require("react");
|
|
2702
|
-
var
|
|
2696
|
+
var import_miden_sdk19 = require("@miden-sdk/miden-sdk");
|
|
2703
2697
|
function useConsume() {
|
|
2704
2698
|
const { client, isReady, sync, runExclusive, prover } = useMiden();
|
|
2705
2699
|
const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
|
|
@@ -2729,7 +2723,7 @@ function useConsume() {
|
|
|
2729
2723
|
const item = options.notes[i];
|
|
2730
2724
|
if (typeof item === "string") {
|
|
2731
2725
|
lookupIndices.push(i);
|
|
2732
|
-
lookupIds.push(
|
|
2726
|
+
lookupIds.push(import_miden_sdk19.NoteId.fromHex(item));
|
|
2733
2727
|
} else if (item !== null && typeof item === "object" && typeof item.toNote === "function") {
|
|
2734
2728
|
resolved[i] = item.toNote();
|
|
2735
2729
|
} else if (item !== null && typeof item === "object" && typeof item.id === "function") {
|
|
@@ -2740,7 +2734,7 @@ function useConsume() {
|
|
|
2740
2734
|
}
|
|
2741
2735
|
}
|
|
2742
2736
|
if (lookupIds.length > 0) {
|
|
2743
|
-
const filter = new
|
|
2737
|
+
const filter = new import_miden_sdk19.NoteFilter(import_miden_sdk19.NoteFilterTypes.List, lookupIds);
|
|
2744
2738
|
const noteRecords = await client.getInputNotes(filter);
|
|
2745
2739
|
if (noteRecords.length !== lookupIds.length) {
|
|
2746
2740
|
throw new Error("Some notes could not be found for provided IDs");
|
|
@@ -2759,12 +2753,6 @@ function useConsume() {
|
|
|
2759
2753
|
}
|
|
2760
2754
|
}
|
|
2761
2755
|
const notes = resolved;
|
|
2762
|
-
if (notes.length === 0) {
|
|
2763
|
-
throw new Error("No notes found for provided IDs");
|
|
2764
|
-
}
|
|
2765
|
-
if (notes.length !== options.notes.length) {
|
|
2766
|
-
throw new Error("Some notes could not be found for provided IDs");
|
|
2767
|
-
}
|
|
2768
2756
|
const txRequest = client.newConsumeTransactionRequest(notes);
|
|
2769
2757
|
const txId = prover ? await client.submitNewTransactionWithProver(
|
|
2770
2758
|
accountIdObj,
|
|
@@ -2831,7 +2819,7 @@ function useSwap() {
|
|
|
2831
2819
|
const requestedFaucetIdObj = parseAccountId(options.requestedFaucetId);
|
|
2832
2820
|
setStage("proving");
|
|
2833
2821
|
const txResult = await runExclusiveSafe(async () => {
|
|
2834
|
-
const txRequest = client.newSwapTransactionRequest(
|
|
2822
|
+
const txRequest = await client.newSwapTransactionRequest(
|
|
2835
2823
|
accountIdObj,
|
|
2836
2824
|
offeredFaucetIdObj,
|
|
2837
2825
|
BigInt(options.offeredAmount),
|
|
@@ -2882,13 +2870,13 @@ function useSwap() {
|
|
|
2882
2870
|
var import_react21 = require("react");
|
|
2883
2871
|
|
|
2884
2872
|
// src/utils/transactions.ts
|
|
2885
|
-
var
|
|
2873
|
+
var import_miden_sdk20 = require("@miden-sdk/miden-sdk");
|
|
2886
2874
|
async function waitForTransactionCommit2(client, runExclusiveSafe, txId, maxWaitMs = 1e4, delayMs = 1e3) {
|
|
2887
2875
|
let waited = 0;
|
|
2888
2876
|
while (waited < maxWaitMs) {
|
|
2889
2877
|
await runExclusiveSafe(() => client.syncState());
|
|
2890
2878
|
const [record] = await runExclusiveSafe(
|
|
2891
|
-
() => client.getTransactions(
|
|
2879
|
+
() => client.getTransactions(import_miden_sdk20.TransactionFilter.ids([txId]))
|
|
2892
2880
|
);
|
|
2893
2881
|
if (record) {
|
|
2894
2882
|
const status = record.transactionStatus();
|
|
@@ -2910,7 +2898,7 @@ function extractFullNotes(txResult) {
|
|
|
2910
2898
|
const notes = executedTx?.outputNotes?.().notes?.() ?? [];
|
|
2911
2899
|
const result = [];
|
|
2912
2900
|
for (const note of notes) {
|
|
2913
|
-
if (note.noteType?.() ===
|
|
2901
|
+
if (note.noteType?.() === import_miden_sdk20.NoteType.Private) {
|
|
2914
2902
|
const full = note.intoFull?.();
|
|
2915
2903
|
if (full) result.push(full);
|
|
2916
2904
|
}
|
|
@@ -2958,7 +2946,7 @@ function useTransaction() {
|
|
|
2958
2946
|
const proverConfig = useMidenStore.getState().config;
|
|
2959
2947
|
const provenTransaction = await proveWithFallback(
|
|
2960
2948
|
(resolvedProver) => runExclusiveSafe(
|
|
2961
|
-
() =>
|
|
2949
|
+
() => client.proveTransaction(txResult, resolvedProver)
|
|
2962
2950
|
),
|
|
2963
2951
|
proverConfig
|
|
2964
2952
|
);
|
|
@@ -3021,7 +3009,7 @@ async function resolveRequest(request, client) {
|
|
|
3021
3009
|
|
|
3022
3010
|
// src/hooks/useExecuteProgram.ts
|
|
3023
3011
|
var import_react22 = require("react");
|
|
3024
|
-
var
|
|
3012
|
+
var import_miden_sdk21 = require("@miden-sdk/miden-sdk");
|
|
3025
3013
|
function isForeignAccountWrapper(fa) {
|
|
3026
3014
|
return fa !== null && typeof fa === "object" && "id" in fa && typeof fa.id !== "function";
|
|
3027
3015
|
}
|
|
@@ -3052,18 +3040,18 @@ function useExecuteProgram() {
|
|
|
3052
3040
|
}
|
|
3053
3041
|
const programResult = await runExclusiveSafe(async () => {
|
|
3054
3042
|
const accountIdObj = parseAccountId(options.accountId);
|
|
3055
|
-
const adviceInputs = options.adviceInputs ?? new
|
|
3043
|
+
const adviceInputs = options.adviceInputs ?? new import_miden_sdk21.AdviceInputs();
|
|
3056
3044
|
let foreignAccountsArray;
|
|
3057
3045
|
if (options.foreignAccounts?.length) {
|
|
3058
3046
|
const accounts = options.foreignAccounts.map((fa) => {
|
|
3059
3047
|
const wrapper = isForeignAccountWrapper(fa);
|
|
3060
3048
|
const id = parseAccountId(wrapper ? fa.id : fa);
|
|
3061
|
-
const storage = wrapper && fa.storage ? fa.storage : new
|
|
3062
|
-
return
|
|
3049
|
+
const storage = wrapper && fa.storage ? fa.storage : new import_miden_sdk21.AccountStorageRequirements();
|
|
3050
|
+
return import_miden_sdk21.ForeignAccount.public(id, storage);
|
|
3063
3051
|
});
|
|
3064
|
-
foreignAccountsArray = new
|
|
3052
|
+
foreignAccountsArray = new import_miden_sdk21.ForeignAccountArray(accounts);
|
|
3065
3053
|
} else {
|
|
3066
|
-
foreignAccountsArray = new
|
|
3054
|
+
foreignAccountsArray = new import_miden_sdk21.ForeignAccountArray();
|
|
3067
3055
|
}
|
|
3068
3056
|
const feltArray = await client.executeProgram(
|
|
3069
3057
|
accountIdObj,
|
|
@@ -3107,11 +3095,11 @@ function useExecuteProgram() {
|
|
|
3107
3095
|
|
|
3108
3096
|
// src/hooks/useCompile.ts
|
|
3109
3097
|
var import_react23 = require("react");
|
|
3110
|
-
var
|
|
3098
|
+
var import_miden_sdk22 = require("@miden-sdk/miden-sdk");
|
|
3111
3099
|
function useCompile() {
|
|
3112
3100
|
const { client, isReady } = useMiden();
|
|
3113
3101
|
const resource = (0, import_react23.useMemo)(
|
|
3114
|
-
() => client && isReady ? new
|
|
3102
|
+
() => client && isReady ? new import_miden_sdk22.CompilerResource(client, import_miden_sdk22.getWasmOrThrow) : null,
|
|
3115
3103
|
[client, isReady]
|
|
3116
3104
|
);
|
|
3117
3105
|
const requireResource = (0, import_react23.useCallback)(() => {
|
|
@@ -3137,7 +3125,7 @@ function useCompile() {
|
|
|
3137
3125
|
|
|
3138
3126
|
// src/hooks/useSessionAccount.ts
|
|
3139
3127
|
var import_react24 = require("react");
|
|
3140
|
-
var
|
|
3128
|
+
var import_miden_sdk23 = require("@miden-sdk/miden-sdk");
|
|
3141
3129
|
function useSessionAccount(options) {
|
|
3142
3130
|
const { client, isReady, sync } = useMiden();
|
|
3143
3131
|
const setAccounts = useMidenStore((state) => state.setAccounts);
|
|
@@ -3261,11 +3249,11 @@ function useSessionAccount(options) {
|
|
|
3261
3249
|
function getStorageMode3(mode) {
|
|
3262
3250
|
switch (mode) {
|
|
3263
3251
|
case "private":
|
|
3264
|
-
return
|
|
3252
|
+
return import_miden_sdk23.AccountStorageMode.private();
|
|
3265
3253
|
case "public":
|
|
3266
|
-
return
|
|
3254
|
+
return import_miden_sdk23.AccountStorageMode.public();
|
|
3267
3255
|
default:
|
|
3268
|
-
return
|
|
3256
|
+
return import_miden_sdk23.AccountStorageMode.public();
|
|
3269
3257
|
}
|
|
3270
3258
|
}
|
|
3271
3259
|
async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cancelledRef) {
|
|
@@ -3290,7 +3278,7 @@ async function waitAndConsume(client, walletId, pollIntervalMs, maxWaitMs, cance
|
|
|
3290
3278
|
|
|
3291
3279
|
// src/hooks/useExportStore.ts
|
|
3292
3280
|
var import_react25 = require("react");
|
|
3293
|
-
var
|
|
3281
|
+
var import_miden_sdk24 = require("@miden-sdk/miden-sdk");
|
|
3294
3282
|
function useExportStore() {
|
|
3295
3283
|
const { client, isReady, runExclusive } = useMiden();
|
|
3296
3284
|
const [isExporting, setIsExporting] = (0, import_react25.useState)(false);
|
|
@@ -3302,8 +3290,8 @@ function useExportStore() {
|
|
|
3302
3290
|
setIsExporting(true);
|
|
3303
3291
|
setError(null);
|
|
3304
3292
|
try {
|
|
3305
|
-
const storeName = client.storeIdentifier();
|
|
3306
|
-
const snapshot = await runExclusive(() => (0,
|
|
3293
|
+
const storeName = await client.storeIdentifier();
|
|
3294
|
+
const snapshot = await runExclusive(() => (0, import_miden_sdk24.exportStore)(storeName));
|
|
3307
3295
|
return snapshot;
|
|
3308
3296
|
} catch (err) {
|
|
3309
3297
|
const error2 = err instanceof Error ? err : new Error(String(err));
|
|
@@ -3327,7 +3315,7 @@ function useExportStore() {
|
|
|
3327
3315
|
|
|
3328
3316
|
// src/hooks/useImportStore.ts
|
|
3329
3317
|
var import_react26 = require("react");
|
|
3330
|
-
var
|
|
3318
|
+
var import_miden_sdk25 = require("@miden-sdk/miden-sdk");
|
|
3331
3319
|
function useImportStore() {
|
|
3332
3320
|
const { client, isReady, runExclusive, sync } = useMiden();
|
|
3333
3321
|
const [isImporting, setIsImporting] = (0, import_react26.useState)(false);
|
|
@@ -3340,7 +3328,7 @@ function useImportStore() {
|
|
|
3340
3328
|
setIsImporting(true);
|
|
3341
3329
|
setError(null);
|
|
3342
3330
|
try {
|
|
3343
|
-
await runExclusive(() => (0,
|
|
3331
|
+
await runExclusive(() => (0, import_miden_sdk25.importStore)(storeName, storeDump));
|
|
3344
3332
|
if (!options?.skipSync) {
|
|
3345
3333
|
await sync();
|
|
3346
3334
|
}
|
|
@@ -3368,7 +3356,7 @@ function useImportStore() {
|
|
|
3368
3356
|
|
|
3369
3357
|
// src/hooks/useImportNote.ts
|
|
3370
3358
|
var import_react27 = require("react");
|
|
3371
|
-
var
|
|
3359
|
+
var import_miden_sdk26 = require("@miden-sdk/miden-sdk");
|
|
3372
3360
|
function useImportNote() {
|
|
3373
3361
|
const { client, isReady, runExclusive, sync } = useMiden();
|
|
3374
3362
|
const [isImporting, setIsImporting] = (0, import_react27.useState)(false);
|
|
@@ -3381,7 +3369,7 @@ function useImportNote() {
|
|
|
3381
3369
|
setIsImporting(true);
|
|
3382
3370
|
setError(null);
|
|
3383
3371
|
try {
|
|
3384
|
-
const noteFile =
|
|
3372
|
+
const noteFile = import_miden_sdk26.NoteFile.deserialize(noteBytes);
|
|
3385
3373
|
const noteId = await runExclusive(
|
|
3386
3374
|
() => client.importNoteFile(noteFile)
|
|
3387
3375
|
);
|
|
@@ -3411,7 +3399,7 @@ function useImportNote() {
|
|
|
3411
3399
|
|
|
3412
3400
|
// src/hooks/useExportNote.ts
|
|
3413
3401
|
var import_react28 = require("react");
|
|
3414
|
-
var
|
|
3402
|
+
var import_miden_sdk27 = require("@miden-sdk/miden-sdk");
|
|
3415
3403
|
function useExportNote() {
|
|
3416
3404
|
const { client, isReady, runExclusive } = useMiden();
|
|
3417
3405
|
const [isExporting, setIsExporting] = (0, import_react28.useState)(false);
|
|
@@ -3425,7 +3413,7 @@ function useExportNote() {
|
|
|
3425
3413
|
setError(null);
|
|
3426
3414
|
try {
|
|
3427
3415
|
const noteFile = await runExclusive(
|
|
3428
|
-
() => client.exportNoteFile(noteId,
|
|
3416
|
+
() => client.exportNoteFile(noteId, import_miden_sdk27.NoteExportFormat.Full)
|
|
3429
3417
|
);
|
|
3430
3418
|
return noteFile.serialize();
|
|
3431
3419
|
} catch (err) {
|
|
@@ -3629,9 +3617,11 @@ installAccountBech32();
|
|
|
3629
3617
|
concatBytes,
|
|
3630
3618
|
createMidenStorage,
|
|
3631
3619
|
createNoteAttachment,
|
|
3620
|
+
ensureAccountBech32,
|
|
3632
3621
|
formatAssetAmount,
|
|
3633
3622
|
formatNoteSummary,
|
|
3634
3623
|
getNoteSummary,
|
|
3624
|
+
installAccountBech32,
|
|
3635
3625
|
migrateStorage,
|
|
3636
3626
|
normalizeAccountId,
|
|
3637
3627
|
parseAssetAmount,
|