@miden-sdk/react 0.14.4 → 0.14.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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +21 -7
- package/dist/index.mjs +34 -11
- package/dist/lazy.d.mts +3 -3
- package/dist/lazy.d.ts +3 -3
- package/dist/lazy.js +21 -7
- package/dist/lazy.mjs +34 -11
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -259,7 +259,7 @@ interface CreateWalletOptions {
|
|
|
259
259
|
storageMode?: StorageMode;
|
|
260
260
|
/** Whether code can be updated. Default: true */
|
|
261
261
|
mutable?: boolean;
|
|
262
|
-
/** Auth scheme. Default: AuthScheme.
|
|
262
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
263
263
|
authScheme?: AuthScheme;
|
|
264
264
|
/** Initial seed for deterministic account ID */
|
|
265
265
|
initSeed?: Uint8Array;
|
|
@@ -273,7 +273,7 @@ interface CreateFaucetOptions {
|
|
|
273
273
|
maxSupply: bigint | number;
|
|
274
274
|
/** Storage mode. Default: private */
|
|
275
275
|
storageMode?: StorageMode;
|
|
276
|
-
/** Auth scheme. Default: AuthScheme.
|
|
276
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
277
277
|
authScheme?: AuthScheme;
|
|
278
278
|
}
|
|
279
279
|
type ImportAccountOptions = {
|
|
@@ -505,7 +505,7 @@ declare const DEFAULTS: {
|
|
|
505
505
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
506
506
|
readonly STORAGE_MODE: "private";
|
|
507
507
|
readonly WALLET_MUTABLE: true;
|
|
508
|
-
readonly AUTH_SCHEME:
|
|
508
|
+
readonly AUTH_SCHEME: "falcon";
|
|
509
509
|
readonly NOTE_TYPE: "private";
|
|
510
510
|
readonly FAUCET_DECIMALS: 8;
|
|
511
511
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -259,7 +259,7 @@ interface CreateWalletOptions {
|
|
|
259
259
|
storageMode?: StorageMode;
|
|
260
260
|
/** Whether code can be updated. Default: true */
|
|
261
261
|
mutable?: boolean;
|
|
262
|
-
/** Auth scheme. Default: AuthScheme.
|
|
262
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
263
263
|
authScheme?: AuthScheme;
|
|
264
264
|
/** Initial seed for deterministic account ID */
|
|
265
265
|
initSeed?: Uint8Array;
|
|
@@ -273,7 +273,7 @@ interface CreateFaucetOptions {
|
|
|
273
273
|
maxSupply: bigint | number;
|
|
274
274
|
/** Storage mode. Default: private */
|
|
275
275
|
storageMode?: StorageMode;
|
|
276
|
-
/** Auth scheme. Default: AuthScheme.
|
|
276
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
277
277
|
authScheme?: AuthScheme;
|
|
278
278
|
}
|
|
279
279
|
type ImportAccountOptions = {
|
|
@@ -505,7 +505,7 @@ declare const DEFAULTS: {
|
|
|
505
505
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
506
506
|
readonly STORAGE_MODE: "private";
|
|
507
507
|
readonly WALLET_MUTABLE: true;
|
|
508
|
-
readonly AUTH_SCHEME:
|
|
508
|
+
readonly AUTH_SCHEME: "falcon";
|
|
509
509
|
readonly NOTE_TYPE: "private";
|
|
510
510
|
readonly FAUCET_DECIMALS: 8;
|
|
511
511
|
};
|
package/dist/index.js
CHANGED
|
@@ -392,7 +392,7 @@ var DEFAULTS = {
|
|
|
392
392
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
393
393
|
STORAGE_MODE: "private",
|
|
394
394
|
WALLET_MUTABLE: true,
|
|
395
|
-
AUTH_SCHEME: import_lazy4.AuthScheme.
|
|
395
|
+
AUTH_SCHEME: import_lazy4.AuthScheme.Falcon,
|
|
396
396
|
NOTE_TYPE: "private",
|
|
397
397
|
FAUCET_DECIMALS: 8
|
|
398
398
|
};
|
|
@@ -535,7 +535,13 @@ function isPrivateStorageMode(storageMode) {
|
|
|
535
535
|
return storageMode.toString() === "private";
|
|
536
536
|
}
|
|
537
537
|
async function initializeSignerAccount(client, config) {
|
|
538
|
-
const {
|
|
538
|
+
const {
|
|
539
|
+
AccountBuilder,
|
|
540
|
+
AccountComponent,
|
|
541
|
+
AuthScheme: AuthScheme2,
|
|
542
|
+
Word: Word2,
|
|
543
|
+
resolveAuthScheme: resolveAuthScheme5
|
|
544
|
+
} = await import("@miden-sdk/miden-sdk");
|
|
539
545
|
await client.syncState();
|
|
540
546
|
if (config.importAccountId) {
|
|
541
547
|
const accountId2 = parseAccountId(config.importAccountId);
|
|
@@ -556,7 +562,7 @@ async function initializeSignerAccount(client, config) {
|
|
|
556
562
|
let builder = new AccountBuilder(seed).withAuthComponent(
|
|
557
563
|
AccountComponent.createAuthComponentFromCommitment(
|
|
558
564
|
commitmentWord,
|
|
559
|
-
AuthScheme2.
|
|
565
|
+
resolveAuthScheme5(AuthScheme2.ECDSA)
|
|
560
566
|
)
|
|
561
567
|
).accountType(accountType).storageMode(config.storageMode).withBasicWalletComponent();
|
|
562
568
|
if (config.customComponents?.length) {
|
|
@@ -1881,7 +1887,9 @@ function useCreateWallet() {
|
|
|
1881
1887
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1882
1888
|
);
|
|
1883
1889
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1884
|
-
const authScheme =
|
|
1890
|
+
const authScheme = (0, import_lazy13.resolveAuthScheme)(
|
|
1891
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1892
|
+
);
|
|
1885
1893
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1886
1894
|
const createdWallet = await client.newWallet(
|
|
1887
1895
|
storageMode,
|
|
@@ -1954,7 +1962,9 @@ function useCreateFaucet() {
|
|
|
1954
1962
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1955
1963
|
);
|
|
1956
1964
|
const decimals = options.decimals ?? DEFAULTS.FAUCET_DECIMALS;
|
|
1957
|
-
const authScheme =
|
|
1965
|
+
const authScheme = (0, import_lazy14.resolveAuthScheme)(
|
|
1966
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1967
|
+
);
|
|
1958
1968
|
const newFaucet = await runExclusiveSafe(async () => {
|
|
1959
1969
|
const createdFaucet = await client.newFaucet(
|
|
1960
1970
|
storageMode,
|
|
@@ -2142,7 +2152,9 @@ function useImportAccount() {
|
|
|
2142
2152
|
}
|
|
2143
2153
|
case "seed": {
|
|
2144
2154
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2145
|
-
const authScheme =
|
|
2155
|
+
const authScheme = (0, import_lazy15.resolveAuthScheme)(
|
|
2156
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
2157
|
+
);
|
|
2146
2158
|
return await client.importPublicAccountFromSeed(
|
|
2147
2159
|
options.seed,
|
|
2148
2160
|
mutable,
|
|
@@ -3151,7 +3163,9 @@ function useSessionAccount(options) {
|
|
|
3151
3163
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3152
3164
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3153
3165
|
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3154
|
-
const authScheme =
|
|
3166
|
+
const authScheme = (0, import_lazy23.resolveAuthScheme)(
|
|
3167
|
+
options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
3168
|
+
);
|
|
3155
3169
|
const fundRef = (0, import_react24.useRef)(options.fund);
|
|
3156
3170
|
fundRef.current = options.fund;
|
|
3157
3171
|
(0, import_react24.useEffect)(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -316,7 +316,7 @@ var DEFAULTS = {
|
|
|
316
316
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
317
|
STORAGE_MODE: "private",
|
|
318
318
|
WALLET_MUTABLE: true,
|
|
319
|
-
AUTH_SCHEME: AuthScheme.
|
|
319
|
+
AUTH_SCHEME: AuthScheme.Falcon,
|
|
320
320
|
NOTE_TYPE: "private",
|
|
321
321
|
FAUCET_DECIMALS: 8
|
|
322
322
|
};
|
|
@@ -459,7 +459,13 @@ function isPrivateStorageMode(storageMode) {
|
|
|
459
459
|
return storageMode.toString() === "private";
|
|
460
460
|
}
|
|
461
461
|
async function initializeSignerAccount(client, config) {
|
|
462
|
-
const {
|
|
462
|
+
const {
|
|
463
|
+
AccountBuilder,
|
|
464
|
+
AccountComponent,
|
|
465
|
+
AuthScheme: AuthScheme2,
|
|
466
|
+
Word: Word2,
|
|
467
|
+
resolveAuthScheme: resolveAuthScheme5
|
|
468
|
+
} = await import("@miden-sdk/miden-sdk");
|
|
463
469
|
await client.syncState();
|
|
464
470
|
if (config.importAccountId) {
|
|
465
471
|
const accountId2 = parseAccountId(config.importAccountId);
|
|
@@ -480,7 +486,7 @@ async function initializeSignerAccount(client, config) {
|
|
|
480
486
|
let builder = new AccountBuilder(seed).withAuthComponent(
|
|
481
487
|
AccountComponent.createAuthComponentFromCommitment(
|
|
482
488
|
commitmentWord,
|
|
483
|
-
AuthScheme2.
|
|
489
|
+
resolveAuthScheme5(AuthScheme2.ECDSA)
|
|
484
490
|
)
|
|
485
491
|
).accountType(accountType).storageMode(config.storageMode).withBasicWalletComponent();
|
|
486
492
|
if (config.customComponents?.length) {
|
|
@@ -1801,7 +1807,10 @@ function useSyncState() {
|
|
|
1801
1807
|
|
|
1802
1808
|
// src/hooks/useCreateWallet.ts
|
|
1803
1809
|
import { useCallback as useCallback9, useState as useState7 } from "react";
|
|
1804
|
-
import {
|
|
1810
|
+
import {
|
|
1811
|
+
AccountStorageMode,
|
|
1812
|
+
resolveAuthScheme
|
|
1813
|
+
} from "@miden-sdk/miden-sdk";
|
|
1805
1814
|
|
|
1806
1815
|
// src/utils/runExclusive.ts
|
|
1807
1816
|
var runExclusiveDirect = async (fn) => fn();
|
|
@@ -1826,7 +1835,9 @@ function useCreateWallet() {
|
|
|
1826
1835
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1827
1836
|
);
|
|
1828
1837
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1829
|
-
const authScheme =
|
|
1838
|
+
const authScheme = resolveAuthScheme(
|
|
1839
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1840
|
+
);
|
|
1830
1841
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1831
1842
|
const createdWallet = await client.newWallet(
|
|
1832
1843
|
storageMode,
|
|
@@ -1879,7 +1890,10 @@ function getStorageMode(mode) {
|
|
|
1879
1890
|
|
|
1880
1891
|
// src/hooks/useCreateFaucet.ts
|
|
1881
1892
|
import { useCallback as useCallback10, useState as useState8 } from "react";
|
|
1882
|
-
import {
|
|
1893
|
+
import {
|
|
1894
|
+
AccountStorageMode as AccountStorageMode2,
|
|
1895
|
+
resolveAuthScheme as resolveAuthScheme2
|
|
1896
|
+
} from "@miden-sdk/miden-sdk";
|
|
1883
1897
|
function useCreateFaucet() {
|
|
1884
1898
|
const { client, isReady, runExclusive } = useMiden();
|
|
1885
1899
|
const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
|
|
@@ -1899,7 +1913,9 @@ function useCreateFaucet() {
|
|
|
1899
1913
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1900
1914
|
);
|
|
1901
1915
|
const decimals = options.decimals ?? DEFAULTS.FAUCET_DECIMALS;
|
|
1902
|
-
const authScheme =
|
|
1916
|
+
const authScheme = resolveAuthScheme2(
|
|
1917
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1918
|
+
);
|
|
1903
1919
|
const newFaucet = await runExclusiveSafe(async () => {
|
|
1904
1920
|
const createdFaucet = await client.newFaucet(
|
|
1905
1921
|
storageMode,
|
|
@@ -1954,7 +1970,7 @@ function getStorageMode2(mode) {
|
|
|
1954
1970
|
|
|
1955
1971
|
// src/hooks/useImportAccount.ts
|
|
1956
1972
|
import { useCallback as useCallback11, useState as useState9 } from "react";
|
|
1957
|
-
import { AccountFile } from "@miden-sdk/miden-sdk";
|
|
1973
|
+
import { AccountFile, resolveAuthScheme as resolveAuthScheme3 } from "@miden-sdk/miden-sdk";
|
|
1958
1974
|
|
|
1959
1975
|
// src/utils/errors.ts
|
|
1960
1976
|
var MidenError = class extends Error {
|
|
@@ -2087,7 +2103,9 @@ function useImportAccount() {
|
|
|
2087
2103
|
}
|
|
2088
2104
|
case "seed": {
|
|
2089
2105
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
|
-
const authScheme =
|
|
2106
|
+
const authScheme = resolveAuthScheme3(
|
|
2107
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
2108
|
+
);
|
|
2091
2109
|
return await client.importPublicAccountFromSeed(
|
|
2092
2110
|
options.seed,
|
|
2093
2111
|
mutable,
|
|
@@ -3103,7 +3121,10 @@ function useCompile() {
|
|
|
3103
3121
|
|
|
3104
3122
|
// src/hooks/useSessionAccount.ts
|
|
3105
3123
|
import { useCallback as useCallback22, useEffect as useEffect9, useRef as useRef8, useState as useState17 } from "react";
|
|
3106
|
-
import {
|
|
3124
|
+
import {
|
|
3125
|
+
AccountStorageMode as AccountStorageMode3,
|
|
3126
|
+
resolveAuthScheme as resolveAuthScheme4
|
|
3127
|
+
} from "@miden-sdk/miden-sdk";
|
|
3107
3128
|
function useSessionAccount(options) {
|
|
3108
3129
|
const { client, isReady, sync } = useMiden();
|
|
3109
3130
|
const setAccounts = useMidenStore((state) => state.setAccounts);
|
|
@@ -3117,7 +3138,9 @@ function useSessionAccount(options) {
|
|
|
3117
3138
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3118
3139
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3119
3140
|
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3120
|
-
const authScheme =
|
|
3141
|
+
const authScheme = resolveAuthScheme4(
|
|
3142
|
+
options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
3143
|
+
);
|
|
3121
3144
|
const fundRef = useRef8(options.fund);
|
|
3122
3145
|
fundRef.current = options.fund;
|
|
3123
3146
|
useEffect9(() => {
|
package/dist/lazy.d.mts
CHANGED
|
@@ -259,7 +259,7 @@ interface CreateWalletOptions {
|
|
|
259
259
|
storageMode?: StorageMode;
|
|
260
260
|
/** Whether code can be updated. Default: true */
|
|
261
261
|
mutable?: boolean;
|
|
262
|
-
/** Auth scheme. Default: AuthScheme.
|
|
262
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
263
263
|
authScheme?: AuthScheme;
|
|
264
264
|
/** Initial seed for deterministic account ID */
|
|
265
265
|
initSeed?: Uint8Array;
|
|
@@ -273,7 +273,7 @@ interface CreateFaucetOptions {
|
|
|
273
273
|
maxSupply: bigint | number;
|
|
274
274
|
/** Storage mode. Default: private */
|
|
275
275
|
storageMode?: StorageMode;
|
|
276
|
-
/** Auth scheme. Default: AuthScheme.
|
|
276
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
277
277
|
authScheme?: AuthScheme;
|
|
278
278
|
}
|
|
279
279
|
type ImportAccountOptions = {
|
|
@@ -505,7 +505,7 @@ declare const DEFAULTS: {
|
|
|
505
505
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
506
506
|
readonly STORAGE_MODE: "private";
|
|
507
507
|
readonly WALLET_MUTABLE: true;
|
|
508
|
-
readonly AUTH_SCHEME:
|
|
508
|
+
readonly AUTH_SCHEME: "falcon";
|
|
509
509
|
readonly NOTE_TYPE: "private";
|
|
510
510
|
readonly FAUCET_DECIMALS: 8;
|
|
511
511
|
};
|
package/dist/lazy.d.ts
CHANGED
|
@@ -259,7 +259,7 @@ interface CreateWalletOptions {
|
|
|
259
259
|
storageMode?: StorageMode;
|
|
260
260
|
/** Whether code can be updated. Default: true */
|
|
261
261
|
mutable?: boolean;
|
|
262
|
-
/** Auth scheme. Default: AuthScheme.
|
|
262
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
263
263
|
authScheme?: AuthScheme;
|
|
264
264
|
/** Initial seed for deterministic account ID */
|
|
265
265
|
initSeed?: Uint8Array;
|
|
@@ -273,7 +273,7 @@ interface CreateFaucetOptions {
|
|
|
273
273
|
maxSupply: bigint | number;
|
|
274
274
|
/** Storage mode. Default: private */
|
|
275
275
|
storageMode?: StorageMode;
|
|
276
|
-
/** Auth scheme. Default: AuthScheme.
|
|
276
|
+
/** Auth scheme. Default: `AuthScheme.Falcon` */
|
|
277
277
|
authScheme?: AuthScheme;
|
|
278
278
|
}
|
|
279
279
|
type ImportAccountOptions = {
|
|
@@ -505,7 +505,7 @@ declare const DEFAULTS: {
|
|
|
505
505
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
506
506
|
readonly STORAGE_MODE: "private";
|
|
507
507
|
readonly WALLET_MUTABLE: true;
|
|
508
|
-
readonly AUTH_SCHEME:
|
|
508
|
+
readonly AUTH_SCHEME: "falcon";
|
|
509
509
|
readonly NOTE_TYPE: "private";
|
|
510
510
|
readonly FAUCET_DECIMALS: 8;
|
|
511
511
|
};
|
package/dist/lazy.js
CHANGED
|
@@ -392,7 +392,7 @@ var DEFAULTS = {
|
|
|
392
392
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
393
393
|
STORAGE_MODE: "private",
|
|
394
394
|
WALLET_MUTABLE: true,
|
|
395
|
-
AUTH_SCHEME: import_lazy4.AuthScheme.
|
|
395
|
+
AUTH_SCHEME: import_lazy4.AuthScheme.Falcon,
|
|
396
396
|
NOTE_TYPE: "private",
|
|
397
397
|
FAUCET_DECIMALS: 8
|
|
398
398
|
};
|
|
@@ -535,7 +535,13 @@ function isPrivateStorageMode(storageMode) {
|
|
|
535
535
|
return storageMode.toString() === "private";
|
|
536
536
|
}
|
|
537
537
|
async function initializeSignerAccount(client, config) {
|
|
538
|
-
const {
|
|
538
|
+
const {
|
|
539
|
+
AccountBuilder,
|
|
540
|
+
AccountComponent,
|
|
541
|
+
AuthScheme: AuthScheme2,
|
|
542
|
+
Word: Word2,
|
|
543
|
+
resolveAuthScheme: resolveAuthScheme5
|
|
544
|
+
} = await import("@miden-sdk/miden-sdk/lazy");
|
|
539
545
|
await client.syncState();
|
|
540
546
|
if (config.importAccountId) {
|
|
541
547
|
const accountId2 = parseAccountId(config.importAccountId);
|
|
@@ -556,7 +562,7 @@ async function initializeSignerAccount(client, config) {
|
|
|
556
562
|
let builder = new AccountBuilder(seed).withAuthComponent(
|
|
557
563
|
AccountComponent.createAuthComponentFromCommitment(
|
|
558
564
|
commitmentWord,
|
|
559
|
-
AuthScheme2.
|
|
565
|
+
resolveAuthScheme5(AuthScheme2.ECDSA)
|
|
560
566
|
)
|
|
561
567
|
).accountType(accountType).storageMode(config.storageMode).withBasicWalletComponent();
|
|
562
568
|
if (config.customComponents?.length) {
|
|
@@ -1881,7 +1887,9 @@ function useCreateWallet() {
|
|
|
1881
1887
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1882
1888
|
);
|
|
1883
1889
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1884
|
-
const authScheme =
|
|
1890
|
+
const authScheme = (0, import_lazy13.resolveAuthScheme)(
|
|
1891
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1892
|
+
);
|
|
1885
1893
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1886
1894
|
const createdWallet = await client.newWallet(
|
|
1887
1895
|
storageMode,
|
|
@@ -1954,7 +1962,9 @@ function useCreateFaucet() {
|
|
|
1954
1962
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1955
1963
|
);
|
|
1956
1964
|
const decimals = options.decimals ?? DEFAULTS.FAUCET_DECIMALS;
|
|
1957
|
-
const authScheme =
|
|
1965
|
+
const authScheme = (0, import_lazy14.resolveAuthScheme)(
|
|
1966
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1967
|
+
);
|
|
1958
1968
|
const newFaucet = await runExclusiveSafe(async () => {
|
|
1959
1969
|
const createdFaucet = await client.newFaucet(
|
|
1960
1970
|
storageMode,
|
|
@@ -2142,7 +2152,9 @@ function useImportAccount() {
|
|
|
2142
2152
|
}
|
|
2143
2153
|
case "seed": {
|
|
2144
2154
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2145
|
-
const authScheme =
|
|
2155
|
+
const authScheme = (0, import_lazy15.resolveAuthScheme)(
|
|
2156
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
2157
|
+
);
|
|
2146
2158
|
return await client.importPublicAccountFromSeed(
|
|
2147
2159
|
options.seed,
|
|
2148
2160
|
mutable,
|
|
@@ -3151,7 +3163,9 @@ function useSessionAccount(options) {
|
|
|
3151
3163
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3152
3164
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3153
3165
|
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3154
|
-
const authScheme =
|
|
3166
|
+
const authScheme = (0, import_lazy23.resolveAuthScheme)(
|
|
3167
|
+
options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
3168
|
+
);
|
|
3155
3169
|
const fundRef = (0, import_react24.useRef)(options.fund);
|
|
3156
3170
|
fundRef.current = options.fund;
|
|
3157
3171
|
(0, import_react24.useEffect)(() => {
|
package/dist/lazy.mjs
CHANGED
|
@@ -316,7 +316,7 @@ var DEFAULTS = {
|
|
|
316
316
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
317
|
STORAGE_MODE: "private",
|
|
318
318
|
WALLET_MUTABLE: true,
|
|
319
|
-
AUTH_SCHEME: AuthScheme.
|
|
319
|
+
AUTH_SCHEME: AuthScheme.Falcon,
|
|
320
320
|
NOTE_TYPE: "private",
|
|
321
321
|
FAUCET_DECIMALS: 8
|
|
322
322
|
};
|
|
@@ -459,7 +459,13 @@ function isPrivateStorageMode(storageMode) {
|
|
|
459
459
|
return storageMode.toString() === "private";
|
|
460
460
|
}
|
|
461
461
|
async function initializeSignerAccount(client, config) {
|
|
462
|
-
const {
|
|
462
|
+
const {
|
|
463
|
+
AccountBuilder,
|
|
464
|
+
AccountComponent,
|
|
465
|
+
AuthScheme: AuthScheme2,
|
|
466
|
+
Word: Word2,
|
|
467
|
+
resolveAuthScheme: resolveAuthScheme5
|
|
468
|
+
} = await import("@miden-sdk/miden-sdk/lazy");
|
|
463
469
|
await client.syncState();
|
|
464
470
|
if (config.importAccountId) {
|
|
465
471
|
const accountId2 = parseAccountId(config.importAccountId);
|
|
@@ -480,7 +486,7 @@ async function initializeSignerAccount(client, config) {
|
|
|
480
486
|
let builder = new AccountBuilder(seed).withAuthComponent(
|
|
481
487
|
AccountComponent.createAuthComponentFromCommitment(
|
|
482
488
|
commitmentWord,
|
|
483
|
-
AuthScheme2.
|
|
489
|
+
resolveAuthScheme5(AuthScheme2.ECDSA)
|
|
484
490
|
)
|
|
485
491
|
).accountType(accountType).storageMode(config.storageMode).withBasicWalletComponent();
|
|
486
492
|
if (config.customComponents?.length) {
|
|
@@ -1801,7 +1807,10 @@ function useSyncState() {
|
|
|
1801
1807
|
|
|
1802
1808
|
// src/hooks/useCreateWallet.ts
|
|
1803
1809
|
import { useCallback as useCallback9, useState as useState7 } from "react";
|
|
1804
|
-
import {
|
|
1810
|
+
import {
|
|
1811
|
+
AccountStorageMode,
|
|
1812
|
+
resolveAuthScheme
|
|
1813
|
+
} from "@miden-sdk/miden-sdk/lazy";
|
|
1805
1814
|
|
|
1806
1815
|
// src/utils/runExclusive.ts
|
|
1807
1816
|
var runExclusiveDirect = async (fn) => fn();
|
|
@@ -1826,7 +1835,9 @@ function useCreateWallet() {
|
|
|
1826
1835
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1827
1836
|
);
|
|
1828
1837
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1829
|
-
const authScheme =
|
|
1838
|
+
const authScheme = resolveAuthScheme(
|
|
1839
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1840
|
+
);
|
|
1830
1841
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1831
1842
|
const createdWallet = await client.newWallet(
|
|
1832
1843
|
storageMode,
|
|
@@ -1879,7 +1890,10 @@ function getStorageMode(mode) {
|
|
|
1879
1890
|
|
|
1880
1891
|
// src/hooks/useCreateFaucet.ts
|
|
1881
1892
|
import { useCallback as useCallback10, useState as useState8 } from "react";
|
|
1882
|
-
import {
|
|
1893
|
+
import {
|
|
1894
|
+
AccountStorageMode as AccountStorageMode2,
|
|
1895
|
+
resolveAuthScheme as resolveAuthScheme2
|
|
1896
|
+
} from "@miden-sdk/miden-sdk/lazy";
|
|
1883
1897
|
function useCreateFaucet() {
|
|
1884
1898
|
const { client, isReady, runExclusive } = useMiden();
|
|
1885
1899
|
const runExclusiveSafe = runExclusive ?? runExclusiveDirect;
|
|
@@ -1899,7 +1913,9 @@ function useCreateFaucet() {
|
|
|
1899
1913
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1900
1914
|
);
|
|
1901
1915
|
const decimals = options.decimals ?? DEFAULTS.FAUCET_DECIMALS;
|
|
1902
|
-
const authScheme =
|
|
1916
|
+
const authScheme = resolveAuthScheme2(
|
|
1917
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
1918
|
+
);
|
|
1903
1919
|
const newFaucet = await runExclusiveSafe(async () => {
|
|
1904
1920
|
const createdFaucet = await client.newFaucet(
|
|
1905
1921
|
storageMode,
|
|
@@ -1954,7 +1970,7 @@ function getStorageMode2(mode) {
|
|
|
1954
1970
|
|
|
1955
1971
|
// src/hooks/useImportAccount.ts
|
|
1956
1972
|
import { useCallback as useCallback11, useState as useState9 } from "react";
|
|
1957
|
-
import { AccountFile } from "@miden-sdk/miden-sdk/lazy";
|
|
1973
|
+
import { AccountFile, resolveAuthScheme as resolveAuthScheme3 } from "@miden-sdk/miden-sdk/lazy";
|
|
1958
1974
|
|
|
1959
1975
|
// src/utils/errors.ts
|
|
1960
1976
|
var MidenError = class extends Error {
|
|
@@ -2087,7 +2103,9 @@ function useImportAccount() {
|
|
|
2087
2103
|
}
|
|
2088
2104
|
case "seed": {
|
|
2089
2105
|
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
|
-
const authScheme =
|
|
2106
|
+
const authScheme = resolveAuthScheme3(
|
|
2107
|
+
options.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
2108
|
+
);
|
|
2091
2109
|
return await client.importPublicAccountFromSeed(
|
|
2092
2110
|
options.seed,
|
|
2093
2111
|
mutable,
|
|
@@ -3103,7 +3121,10 @@ function useCompile() {
|
|
|
3103
3121
|
|
|
3104
3122
|
// src/hooks/useSessionAccount.ts
|
|
3105
3123
|
import { useCallback as useCallback22, useEffect as useEffect9, useRef as useRef8, useState as useState17 } from "react";
|
|
3106
|
-
import {
|
|
3124
|
+
import {
|
|
3125
|
+
AccountStorageMode as AccountStorageMode3,
|
|
3126
|
+
resolveAuthScheme as resolveAuthScheme4
|
|
3127
|
+
} from "@miden-sdk/miden-sdk/lazy";
|
|
3107
3128
|
function useSessionAccount(options) {
|
|
3108
3129
|
const { client, isReady, sync } = useMiden();
|
|
3109
3130
|
const setAccounts = useMidenStore((state) => state.setAccounts);
|
|
@@ -3117,7 +3138,9 @@ function useSessionAccount(options) {
|
|
|
3117
3138
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3118
3139
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3119
3140
|
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3120
|
-
const authScheme =
|
|
3141
|
+
const authScheme = resolveAuthScheme4(
|
|
3142
|
+
options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME
|
|
3143
|
+
);
|
|
3121
3144
|
const fundRef = useRef8(options.fund);
|
|
3122
3145
|
fundRef.current = options.fund;
|
|
3123
3146
|
useEffect9(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miden-sdk/react",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "React hooks library for Miden Web Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"test:all": "VITE_CJS_IGNORE_WARNING=1 vitest run && playwright test"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@miden-sdk/miden-sdk": "^0.14.
|
|
36
|
+
"@miden-sdk/miden-sdk": "^0.14.5",
|
|
37
37
|
"react": ">=18.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|