@miden-sdk/react 0.15.0-alpha.7 → 0.15.0
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.ts +16 -9
- package/dist/index.mjs +6 -43
- package/dist/lazy.d.ts +16 -9
- package/dist/lazy.mjs +6 -43
- package/dist/mt/lazy.d.ts +16 -9
- package/dist/mt/lazy.mjs +6 -43
- package/dist/mt.d.ts +16 -9
- package/dist/mt.mjs +6 -43
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignerAccountType = "RegularAccountImmutableCode" | "RegularAccountUpdatabl
|
|
|
51
51
|
interface SignerAccountConfig {
|
|
52
52
|
/** Public key commitment (for auth component) */
|
|
53
53
|
publicKeyCommitment: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Ignored as of protocol 0.15. Code mutability and faucet/wallet
|
|
56
|
+
* account types are no longer encoded in the account, so this value has no
|
|
57
|
+
* effect on the built account and is safe to omit.
|
|
58
|
+
*/
|
|
59
|
+
accountType?: SignerAccountType;
|
|
60
|
+
/** Storage mode (public or private) */
|
|
57
61
|
storageMode: AccountStorageMode;
|
|
58
62
|
/** Optional seed for deterministic account ID */
|
|
59
63
|
accountSeed?: Uint8Array;
|
|
@@ -196,7 +200,16 @@ interface SyncState {
|
|
|
196
200
|
}
|
|
197
201
|
interface AccountsResult {
|
|
198
202
|
accounts: AccountHeader[];
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Protocol 0.15 removed faucet-vs-wallet from the account id, so
|
|
205
|
+
* accounts can no longer be split from headers alone. `wallets` mirrors
|
|
206
|
+
* `accounts`. Use `accounts` and detect faucets per-account from its components.
|
|
207
|
+
*/
|
|
199
208
|
wallets: AccountHeader[];
|
|
209
|
+
/**
|
|
210
|
+
* @deprecated Always empty as of protocol 0.15 (see `wallets`). Detect faucets
|
|
211
|
+
* per-account from its components instead.
|
|
212
|
+
*/
|
|
200
213
|
faucets: AccountHeader[];
|
|
201
214
|
isLoading: boolean;
|
|
202
215
|
error: Error | null;
|
|
@@ -273,8 +286,6 @@ interface NoteSummary {
|
|
|
273
286
|
interface CreateWalletOptions {
|
|
274
287
|
/** Storage mode. Default: private */
|
|
275
288
|
storageMode?: StorageMode;
|
|
276
|
-
/** Whether code can be updated. Default: true */
|
|
277
|
-
mutable?: boolean;
|
|
278
289
|
/** Auth scheme. Default: AuthScheme.AuthRpoFalcon512 */
|
|
279
290
|
authScheme?: AuthScheme;
|
|
280
291
|
/** Initial seed for deterministic account ID */
|
|
@@ -303,7 +314,6 @@ type ImportAccountOptions = {
|
|
|
303
314
|
} | {
|
|
304
315
|
type: "seed";
|
|
305
316
|
seed: Uint8Array;
|
|
306
|
-
mutable?: boolean;
|
|
307
317
|
authScheme?: AuthScheme;
|
|
308
318
|
};
|
|
309
319
|
interface SendOptions {
|
|
@@ -541,7 +551,6 @@ interface UseSessionAccountOptions {
|
|
|
541
551
|
/** Wallet creation options */
|
|
542
552
|
walletOptions?: {
|
|
543
553
|
storageMode?: "private" | "public";
|
|
544
|
-
mutable?: boolean;
|
|
545
554
|
authScheme?: AuthScheme;
|
|
546
555
|
};
|
|
547
556
|
/** Polling interval for funding note detection (ms). Default: 3000 */
|
|
@@ -570,7 +579,6 @@ declare const DEFAULTS: {
|
|
|
570
579
|
readonly RPC_URL: undefined;
|
|
571
580
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
572
581
|
readonly STORAGE_MODE: "private";
|
|
573
|
-
readonly WALLET_MUTABLE: true;
|
|
574
582
|
readonly AUTH_SCHEME: AuthScheme.AuthRpoFalcon512;
|
|
575
583
|
readonly NOTE_TYPE: "private";
|
|
576
584
|
readonly FAUCET_DECIMALS: 8;
|
|
@@ -829,7 +837,6 @@ interface UseCreateWalletResult {
|
|
|
829
837
|
* const handleCreate = async () => {
|
|
830
838
|
* const newWallet = await createWallet({
|
|
831
839
|
* storageMode: 'private',
|
|
832
|
-
* mutable: true,
|
|
833
840
|
* });
|
|
834
841
|
* console.log('Created wallet:', newWallet.id().toString());
|
|
835
842
|
* };
|
package/dist/index.mjs
CHANGED
|
@@ -177,19 +177,6 @@ var parseAccountId = (value) => {
|
|
|
177
177
|
}
|
|
178
178
|
return value;
|
|
179
179
|
};
|
|
180
|
-
function isFaucetId(accountId) {
|
|
181
|
-
try {
|
|
182
|
-
let hex = typeof accountId.toHex === "function" ? accountId.toHex() : String(accountId);
|
|
183
|
-
if (hex.startsWith("0x") || hex.startsWith("0X")) {
|
|
184
|
-
hex = hex.slice(2);
|
|
185
|
-
}
|
|
186
|
-
const firstByte = parseInt(hex.slice(0, 2), 16);
|
|
187
|
-
const accountType = firstByte >> 4 & 3;
|
|
188
|
-
return accountType === 2 || accountType === 3;
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
180
|
var parseAddress = (value, accountId) => {
|
|
194
181
|
if (typeof value !== "string") {
|
|
195
182
|
const resolvedId = accountId ?? parseAccountId(value);
|
|
@@ -315,7 +302,6 @@ var DEFAULTS = {
|
|
|
315
302
|
// Will use SDK's testnet default
|
|
316
303
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
304
|
STORAGE_MODE: "private",
|
|
318
|
-
WALLET_MUTABLE: true,
|
|
319
305
|
AUTH_SCHEME: AuthScheme.AuthRpoFalcon512,
|
|
320
306
|
NOTE_TYPE: "private",
|
|
321
307
|
FAUCET_DECIMALS: 8
|
|
@@ -585,7 +571,6 @@ function MidenProvider({
|
|
|
585
571
|
}, [client, isReady, setSyncState]);
|
|
586
572
|
const signerIsConnected = signerContext?.isConnected ?? null;
|
|
587
573
|
const signerStoreName = signerContext?.storeName ?? null;
|
|
588
|
-
const signerAccountType = signerContext?.accountConfig?.accountType ?? null;
|
|
589
574
|
const signerStorageMode = signerContext?.accountConfig?.storageMode?.toString() ?? null;
|
|
590
575
|
useEffect(() => {
|
|
591
576
|
signCbRef.current = signerContext?.signCb ?? null;
|
|
@@ -719,12 +704,11 @@ function MidenProvider({
|
|
|
719
704
|
setSignerConnected,
|
|
720
705
|
signerIsConnected,
|
|
721
706
|
signerStoreName,
|
|
722
|
-
signerAccountType,
|
|
723
707
|
signerStorageMode,
|
|
724
708
|
wrappedSignCb
|
|
725
|
-
// Note: signerContext is intentionally NOT a dep
|
|
726
|
-
// (signerIsConnected, signerStoreName,
|
|
727
|
-
//
|
|
709
|
+
// Note: signerContext is intentionally NOT a dep. We use stable primitives
|
|
710
|
+
// (signerIsConnected, signerStoreName, signerStorageMode) to avoid
|
|
711
|
+
// re-running when the signer provider creates a new object ref.
|
|
728
712
|
// signCb changes are handled by the dedicated useEffect + signCbRef above,
|
|
729
713
|
// not by this effect.
|
|
730
714
|
]);
|
|
@@ -986,20 +970,10 @@ function useAccounts() {
|
|
|
986
970
|
refetch();
|
|
987
971
|
}
|
|
988
972
|
}, [isReady, accounts.length, refetch]);
|
|
989
|
-
const wallets = [];
|
|
990
|
-
const faucets = [];
|
|
991
|
-
for (const account of accounts) {
|
|
992
|
-
const accountId = account.id();
|
|
993
|
-
if (isFaucetId(accountId)) {
|
|
994
|
-
faucets.push(account);
|
|
995
|
-
} else {
|
|
996
|
-
wallets.push(account);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
973
|
return {
|
|
1000
974
|
accounts,
|
|
1001
|
-
wallets,
|
|
1002
|
-
faucets,
|
|
975
|
+
wallets: accounts,
|
|
976
|
+
faucets: [],
|
|
1003
977
|
isLoading: isLoadingAccounts,
|
|
1004
978
|
error: null,
|
|
1005
979
|
refetch
|
|
@@ -1034,7 +1008,6 @@ var getRpcClient = (rpcUrl) => {
|
|
|
1034
1008
|
var fetchAssetMetadata = async (rpcClient, assetId) => {
|
|
1035
1009
|
try {
|
|
1036
1010
|
const accountId = parseAccountId(assetId);
|
|
1037
|
-
if (!isFaucetId(accountId)) return null;
|
|
1038
1011
|
const fetched = await rpcClient.getAccountDetails(accountId);
|
|
1039
1012
|
const account = fetched.account?.();
|
|
1040
1013
|
if (!account) return null;
|
|
@@ -1828,12 +1801,10 @@ function useCreateWallet() {
|
|
|
1828
1801
|
const storageMode = getStorageMode(
|
|
1829
1802
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1830
1803
|
);
|
|
1831
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1832
1804
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
1833
1805
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1834
1806
|
const createdWallet = await client.newWallet(
|
|
1835
1807
|
storageMode,
|
|
1836
|
-
mutable,
|
|
1837
1808
|
authScheme,
|
|
1838
1809
|
options.initSeed
|
|
1839
1810
|
);
|
|
@@ -2086,11 +2057,9 @@ function useImportAccount() {
|
|
|
2086
2057
|
return fetchedAccount;
|
|
2087
2058
|
}
|
|
2088
2059
|
case "seed": {
|
|
2089
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
2060
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
2091
2061
|
return await client.importPublicAccountFromSeed(
|
|
2092
2062
|
options.seed,
|
|
2093
|
-
mutable,
|
|
2094
2063
|
authScheme
|
|
2095
2064
|
);
|
|
2096
2065
|
}
|
|
@@ -3339,7 +3308,6 @@ function useSessionAccount(options) {
|
|
|
3339
3308
|
const pollIntervalMs = options.pollIntervalMs ?? 3e3;
|
|
3340
3309
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3341
3310
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3342
|
-
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3343
3311
|
const authScheme = options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
3344
3312
|
const fundRef = useRef8(options.fund);
|
|
3345
3313
|
fundRef.current = options.fund;
|
|
@@ -3378,11 +3346,7 @@ function useSessionAccount(options) {
|
|
|
3378
3346
|
if (!walletId) {
|
|
3379
3347
|
setStep("creating");
|
|
3380
3348
|
const resolvedStorageMode = getStorageMode3(storageMode);
|
|
3381
|
-
const wallet = await client.newWallet(
|
|
3382
|
-
resolvedStorageMode,
|
|
3383
|
-
mutable,
|
|
3384
|
-
authScheme
|
|
3385
|
-
);
|
|
3349
|
+
const wallet = await client.newWallet(resolvedStorageMode, authScheme);
|
|
3386
3350
|
ensureAccountBech32(wallet);
|
|
3387
3351
|
const accounts = await client.getAccounts();
|
|
3388
3352
|
setAccounts(accounts);
|
|
@@ -3422,7 +3386,6 @@ function useSessionAccount(options) {
|
|
|
3422
3386
|
sync,
|
|
3423
3387
|
sessionAccountId,
|
|
3424
3388
|
storageMode,
|
|
3425
|
-
mutable,
|
|
3426
3389
|
authScheme,
|
|
3427
3390
|
storagePrefix,
|
|
3428
3391
|
pollIntervalMs,
|
package/dist/lazy.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignerAccountType = "RegularAccountImmutableCode" | "RegularAccountUpdatabl
|
|
|
51
51
|
interface SignerAccountConfig {
|
|
52
52
|
/** Public key commitment (for auth component) */
|
|
53
53
|
publicKeyCommitment: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Ignored as of protocol 0.15. Code mutability and faucet/wallet
|
|
56
|
+
* account types are no longer encoded in the account, so this value has no
|
|
57
|
+
* effect on the built account and is safe to omit.
|
|
58
|
+
*/
|
|
59
|
+
accountType?: SignerAccountType;
|
|
60
|
+
/** Storage mode (public or private) */
|
|
57
61
|
storageMode: AccountStorageMode;
|
|
58
62
|
/** Optional seed for deterministic account ID */
|
|
59
63
|
accountSeed?: Uint8Array;
|
|
@@ -196,7 +200,16 @@ interface SyncState {
|
|
|
196
200
|
}
|
|
197
201
|
interface AccountsResult {
|
|
198
202
|
accounts: AccountHeader[];
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Protocol 0.15 removed faucet-vs-wallet from the account id, so
|
|
205
|
+
* accounts can no longer be split from headers alone. `wallets` mirrors
|
|
206
|
+
* `accounts`. Use `accounts` and detect faucets per-account from its components.
|
|
207
|
+
*/
|
|
199
208
|
wallets: AccountHeader[];
|
|
209
|
+
/**
|
|
210
|
+
* @deprecated Always empty as of protocol 0.15 (see `wallets`). Detect faucets
|
|
211
|
+
* per-account from its components instead.
|
|
212
|
+
*/
|
|
200
213
|
faucets: AccountHeader[];
|
|
201
214
|
isLoading: boolean;
|
|
202
215
|
error: Error | null;
|
|
@@ -273,8 +286,6 @@ interface NoteSummary {
|
|
|
273
286
|
interface CreateWalletOptions {
|
|
274
287
|
/** Storage mode. Default: private */
|
|
275
288
|
storageMode?: StorageMode;
|
|
276
|
-
/** Whether code can be updated. Default: true */
|
|
277
|
-
mutable?: boolean;
|
|
278
289
|
/** Auth scheme. Default: AuthScheme.AuthRpoFalcon512 */
|
|
279
290
|
authScheme?: AuthScheme;
|
|
280
291
|
/** Initial seed for deterministic account ID */
|
|
@@ -303,7 +314,6 @@ type ImportAccountOptions = {
|
|
|
303
314
|
} | {
|
|
304
315
|
type: "seed";
|
|
305
316
|
seed: Uint8Array;
|
|
306
|
-
mutable?: boolean;
|
|
307
317
|
authScheme?: AuthScheme;
|
|
308
318
|
};
|
|
309
319
|
interface SendOptions {
|
|
@@ -541,7 +551,6 @@ interface UseSessionAccountOptions {
|
|
|
541
551
|
/** Wallet creation options */
|
|
542
552
|
walletOptions?: {
|
|
543
553
|
storageMode?: "private" | "public";
|
|
544
|
-
mutable?: boolean;
|
|
545
554
|
authScheme?: AuthScheme;
|
|
546
555
|
};
|
|
547
556
|
/** Polling interval for funding note detection (ms). Default: 3000 */
|
|
@@ -570,7 +579,6 @@ declare const DEFAULTS: {
|
|
|
570
579
|
readonly RPC_URL: undefined;
|
|
571
580
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
572
581
|
readonly STORAGE_MODE: "private";
|
|
573
|
-
readonly WALLET_MUTABLE: true;
|
|
574
582
|
readonly AUTH_SCHEME: AuthScheme.AuthRpoFalcon512;
|
|
575
583
|
readonly NOTE_TYPE: "private";
|
|
576
584
|
readonly FAUCET_DECIMALS: 8;
|
|
@@ -829,7 +837,6 @@ interface UseCreateWalletResult {
|
|
|
829
837
|
* const handleCreate = async () => {
|
|
830
838
|
* const newWallet = await createWallet({
|
|
831
839
|
* storageMode: 'private',
|
|
832
|
-
* mutable: true,
|
|
833
840
|
* });
|
|
834
841
|
* console.log('Created wallet:', newWallet.id().toString());
|
|
835
842
|
* };
|
package/dist/lazy.mjs
CHANGED
|
@@ -177,19 +177,6 @@ var parseAccountId = (value) => {
|
|
|
177
177
|
}
|
|
178
178
|
return value;
|
|
179
179
|
};
|
|
180
|
-
function isFaucetId(accountId) {
|
|
181
|
-
try {
|
|
182
|
-
let hex = typeof accountId.toHex === "function" ? accountId.toHex() : String(accountId);
|
|
183
|
-
if (hex.startsWith("0x") || hex.startsWith("0X")) {
|
|
184
|
-
hex = hex.slice(2);
|
|
185
|
-
}
|
|
186
|
-
const firstByte = parseInt(hex.slice(0, 2), 16);
|
|
187
|
-
const accountType = firstByte >> 4 & 3;
|
|
188
|
-
return accountType === 2 || accountType === 3;
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
180
|
var parseAddress = (value, accountId) => {
|
|
194
181
|
if (typeof value !== "string") {
|
|
195
182
|
const resolvedId = accountId ?? parseAccountId(value);
|
|
@@ -315,7 +302,6 @@ var DEFAULTS = {
|
|
|
315
302
|
// Will use SDK's testnet default
|
|
316
303
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
304
|
STORAGE_MODE: "private",
|
|
318
|
-
WALLET_MUTABLE: true,
|
|
319
305
|
AUTH_SCHEME: AuthScheme.AuthRpoFalcon512,
|
|
320
306
|
NOTE_TYPE: "private",
|
|
321
307
|
FAUCET_DECIMALS: 8
|
|
@@ -585,7 +571,6 @@ function MidenProvider({
|
|
|
585
571
|
}, [client, isReady, setSyncState]);
|
|
586
572
|
const signerIsConnected = signerContext?.isConnected ?? null;
|
|
587
573
|
const signerStoreName = signerContext?.storeName ?? null;
|
|
588
|
-
const signerAccountType = signerContext?.accountConfig?.accountType ?? null;
|
|
589
574
|
const signerStorageMode = signerContext?.accountConfig?.storageMode?.toString() ?? null;
|
|
590
575
|
useEffect(() => {
|
|
591
576
|
signCbRef.current = signerContext?.signCb ?? null;
|
|
@@ -719,12 +704,11 @@ function MidenProvider({
|
|
|
719
704
|
setSignerConnected,
|
|
720
705
|
signerIsConnected,
|
|
721
706
|
signerStoreName,
|
|
722
|
-
signerAccountType,
|
|
723
707
|
signerStorageMode,
|
|
724
708
|
wrappedSignCb
|
|
725
|
-
// Note: signerContext is intentionally NOT a dep
|
|
726
|
-
// (signerIsConnected, signerStoreName,
|
|
727
|
-
//
|
|
709
|
+
// Note: signerContext is intentionally NOT a dep. We use stable primitives
|
|
710
|
+
// (signerIsConnected, signerStoreName, signerStorageMode) to avoid
|
|
711
|
+
// re-running when the signer provider creates a new object ref.
|
|
728
712
|
// signCb changes are handled by the dedicated useEffect + signCbRef above,
|
|
729
713
|
// not by this effect.
|
|
730
714
|
]);
|
|
@@ -986,20 +970,10 @@ function useAccounts() {
|
|
|
986
970
|
refetch();
|
|
987
971
|
}
|
|
988
972
|
}, [isReady, accounts.length, refetch]);
|
|
989
|
-
const wallets = [];
|
|
990
|
-
const faucets = [];
|
|
991
|
-
for (const account of accounts) {
|
|
992
|
-
const accountId = account.id();
|
|
993
|
-
if (isFaucetId(accountId)) {
|
|
994
|
-
faucets.push(account);
|
|
995
|
-
} else {
|
|
996
|
-
wallets.push(account);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
973
|
return {
|
|
1000
974
|
accounts,
|
|
1001
|
-
wallets,
|
|
1002
|
-
faucets,
|
|
975
|
+
wallets: accounts,
|
|
976
|
+
faucets: [],
|
|
1003
977
|
isLoading: isLoadingAccounts,
|
|
1004
978
|
error: null,
|
|
1005
979
|
refetch
|
|
@@ -1034,7 +1008,6 @@ var getRpcClient = (rpcUrl) => {
|
|
|
1034
1008
|
var fetchAssetMetadata = async (rpcClient, assetId) => {
|
|
1035
1009
|
try {
|
|
1036
1010
|
const accountId = parseAccountId(assetId);
|
|
1037
|
-
if (!isFaucetId(accountId)) return null;
|
|
1038
1011
|
const fetched = await rpcClient.getAccountDetails(accountId);
|
|
1039
1012
|
const account = fetched.account?.();
|
|
1040
1013
|
if (!account) return null;
|
|
@@ -1828,12 +1801,10 @@ function useCreateWallet() {
|
|
|
1828
1801
|
const storageMode = getStorageMode(
|
|
1829
1802
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1830
1803
|
);
|
|
1831
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1832
1804
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
1833
1805
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1834
1806
|
const createdWallet = await client.newWallet(
|
|
1835
1807
|
storageMode,
|
|
1836
|
-
mutable,
|
|
1837
1808
|
authScheme,
|
|
1838
1809
|
options.initSeed
|
|
1839
1810
|
);
|
|
@@ -2086,11 +2057,9 @@ function useImportAccount() {
|
|
|
2086
2057
|
return fetchedAccount;
|
|
2087
2058
|
}
|
|
2088
2059
|
case "seed": {
|
|
2089
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
2060
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
2091
2061
|
return await client.importPublicAccountFromSeed(
|
|
2092
2062
|
options.seed,
|
|
2093
|
-
mutable,
|
|
2094
2063
|
authScheme
|
|
2095
2064
|
);
|
|
2096
2065
|
}
|
|
@@ -3339,7 +3308,6 @@ function useSessionAccount(options) {
|
|
|
3339
3308
|
const pollIntervalMs = options.pollIntervalMs ?? 3e3;
|
|
3340
3309
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3341
3310
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3342
|
-
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3343
3311
|
const authScheme = options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
3344
3312
|
const fundRef = useRef8(options.fund);
|
|
3345
3313
|
fundRef.current = options.fund;
|
|
@@ -3378,11 +3346,7 @@ function useSessionAccount(options) {
|
|
|
3378
3346
|
if (!walletId) {
|
|
3379
3347
|
setStep("creating");
|
|
3380
3348
|
const resolvedStorageMode = getStorageMode3(storageMode);
|
|
3381
|
-
const wallet = await client.newWallet(
|
|
3382
|
-
resolvedStorageMode,
|
|
3383
|
-
mutable,
|
|
3384
|
-
authScheme
|
|
3385
|
-
);
|
|
3349
|
+
const wallet = await client.newWallet(resolvedStorageMode, authScheme);
|
|
3386
3350
|
ensureAccountBech32(wallet);
|
|
3387
3351
|
const accounts = await client.getAccounts();
|
|
3388
3352
|
setAccounts(accounts);
|
|
@@ -3422,7 +3386,6 @@ function useSessionAccount(options) {
|
|
|
3422
3386
|
sync,
|
|
3423
3387
|
sessionAccountId,
|
|
3424
3388
|
storageMode,
|
|
3425
|
-
mutable,
|
|
3426
3389
|
authScheme,
|
|
3427
3390
|
storagePrefix,
|
|
3428
3391
|
pollIntervalMs,
|
package/dist/mt/lazy.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignerAccountType = "RegularAccountImmutableCode" | "RegularAccountUpdatabl
|
|
|
51
51
|
interface SignerAccountConfig {
|
|
52
52
|
/** Public key commitment (for auth component) */
|
|
53
53
|
publicKeyCommitment: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Ignored as of protocol 0.15. Code mutability and faucet/wallet
|
|
56
|
+
* account types are no longer encoded in the account, so this value has no
|
|
57
|
+
* effect on the built account and is safe to omit.
|
|
58
|
+
*/
|
|
59
|
+
accountType?: SignerAccountType;
|
|
60
|
+
/** Storage mode (public or private) */
|
|
57
61
|
storageMode: AccountStorageMode;
|
|
58
62
|
/** Optional seed for deterministic account ID */
|
|
59
63
|
accountSeed?: Uint8Array;
|
|
@@ -196,7 +200,16 @@ interface SyncState {
|
|
|
196
200
|
}
|
|
197
201
|
interface AccountsResult {
|
|
198
202
|
accounts: AccountHeader[];
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Protocol 0.15 removed faucet-vs-wallet from the account id, so
|
|
205
|
+
* accounts can no longer be split from headers alone. `wallets` mirrors
|
|
206
|
+
* `accounts`. Use `accounts` and detect faucets per-account from its components.
|
|
207
|
+
*/
|
|
199
208
|
wallets: AccountHeader[];
|
|
209
|
+
/**
|
|
210
|
+
* @deprecated Always empty as of protocol 0.15 (see `wallets`). Detect faucets
|
|
211
|
+
* per-account from its components instead.
|
|
212
|
+
*/
|
|
200
213
|
faucets: AccountHeader[];
|
|
201
214
|
isLoading: boolean;
|
|
202
215
|
error: Error | null;
|
|
@@ -273,8 +286,6 @@ interface NoteSummary {
|
|
|
273
286
|
interface CreateWalletOptions {
|
|
274
287
|
/** Storage mode. Default: private */
|
|
275
288
|
storageMode?: StorageMode;
|
|
276
|
-
/** Whether code can be updated. Default: true */
|
|
277
|
-
mutable?: boolean;
|
|
278
289
|
/** Auth scheme. Default: AuthScheme.AuthRpoFalcon512 */
|
|
279
290
|
authScheme?: AuthScheme;
|
|
280
291
|
/** Initial seed for deterministic account ID */
|
|
@@ -303,7 +314,6 @@ type ImportAccountOptions = {
|
|
|
303
314
|
} | {
|
|
304
315
|
type: "seed";
|
|
305
316
|
seed: Uint8Array;
|
|
306
|
-
mutable?: boolean;
|
|
307
317
|
authScheme?: AuthScheme;
|
|
308
318
|
};
|
|
309
319
|
interface SendOptions {
|
|
@@ -541,7 +551,6 @@ interface UseSessionAccountOptions {
|
|
|
541
551
|
/** Wallet creation options */
|
|
542
552
|
walletOptions?: {
|
|
543
553
|
storageMode?: "private" | "public";
|
|
544
|
-
mutable?: boolean;
|
|
545
554
|
authScheme?: AuthScheme;
|
|
546
555
|
};
|
|
547
556
|
/** Polling interval for funding note detection (ms). Default: 3000 */
|
|
@@ -570,7 +579,6 @@ declare const DEFAULTS: {
|
|
|
570
579
|
readonly RPC_URL: undefined;
|
|
571
580
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
572
581
|
readonly STORAGE_MODE: "private";
|
|
573
|
-
readonly WALLET_MUTABLE: true;
|
|
574
582
|
readonly AUTH_SCHEME: AuthScheme.AuthRpoFalcon512;
|
|
575
583
|
readonly NOTE_TYPE: "private";
|
|
576
584
|
readonly FAUCET_DECIMALS: 8;
|
|
@@ -829,7 +837,6 @@ interface UseCreateWalletResult {
|
|
|
829
837
|
* const handleCreate = async () => {
|
|
830
838
|
* const newWallet = await createWallet({
|
|
831
839
|
* storageMode: 'private',
|
|
832
|
-
* mutable: true,
|
|
833
840
|
* });
|
|
834
841
|
* console.log('Created wallet:', newWallet.id().toString());
|
|
835
842
|
* };
|
package/dist/mt/lazy.mjs
CHANGED
|
@@ -177,19 +177,6 @@ var parseAccountId = (value) => {
|
|
|
177
177
|
}
|
|
178
178
|
return value;
|
|
179
179
|
};
|
|
180
|
-
function isFaucetId(accountId) {
|
|
181
|
-
try {
|
|
182
|
-
let hex = typeof accountId.toHex === "function" ? accountId.toHex() : String(accountId);
|
|
183
|
-
if (hex.startsWith("0x") || hex.startsWith("0X")) {
|
|
184
|
-
hex = hex.slice(2);
|
|
185
|
-
}
|
|
186
|
-
const firstByte = parseInt(hex.slice(0, 2), 16);
|
|
187
|
-
const accountType = firstByte >> 4 & 3;
|
|
188
|
-
return accountType === 2 || accountType === 3;
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
180
|
var parseAddress = (value, accountId) => {
|
|
194
181
|
if (typeof value !== "string") {
|
|
195
182
|
const resolvedId = accountId ?? parseAccountId(value);
|
|
@@ -315,7 +302,6 @@ var DEFAULTS = {
|
|
|
315
302
|
// Will use SDK's testnet default
|
|
316
303
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
304
|
STORAGE_MODE: "private",
|
|
318
|
-
WALLET_MUTABLE: true,
|
|
319
305
|
AUTH_SCHEME: AuthScheme.AuthRpoFalcon512,
|
|
320
306
|
NOTE_TYPE: "private",
|
|
321
307
|
FAUCET_DECIMALS: 8
|
|
@@ -585,7 +571,6 @@ function MidenProvider({
|
|
|
585
571
|
}, [client, isReady, setSyncState]);
|
|
586
572
|
const signerIsConnected = signerContext?.isConnected ?? null;
|
|
587
573
|
const signerStoreName = signerContext?.storeName ?? null;
|
|
588
|
-
const signerAccountType = signerContext?.accountConfig?.accountType ?? null;
|
|
589
574
|
const signerStorageMode = signerContext?.accountConfig?.storageMode?.toString() ?? null;
|
|
590
575
|
useEffect(() => {
|
|
591
576
|
signCbRef.current = signerContext?.signCb ?? null;
|
|
@@ -719,12 +704,11 @@ function MidenProvider({
|
|
|
719
704
|
setSignerConnected,
|
|
720
705
|
signerIsConnected,
|
|
721
706
|
signerStoreName,
|
|
722
|
-
signerAccountType,
|
|
723
707
|
signerStorageMode,
|
|
724
708
|
wrappedSignCb
|
|
725
|
-
// Note: signerContext is intentionally NOT a dep
|
|
726
|
-
// (signerIsConnected, signerStoreName,
|
|
727
|
-
//
|
|
709
|
+
// Note: signerContext is intentionally NOT a dep. We use stable primitives
|
|
710
|
+
// (signerIsConnected, signerStoreName, signerStorageMode) to avoid
|
|
711
|
+
// re-running when the signer provider creates a new object ref.
|
|
728
712
|
// signCb changes are handled by the dedicated useEffect + signCbRef above,
|
|
729
713
|
// not by this effect.
|
|
730
714
|
]);
|
|
@@ -986,20 +970,10 @@ function useAccounts() {
|
|
|
986
970
|
refetch();
|
|
987
971
|
}
|
|
988
972
|
}, [isReady, accounts.length, refetch]);
|
|
989
|
-
const wallets = [];
|
|
990
|
-
const faucets = [];
|
|
991
|
-
for (const account of accounts) {
|
|
992
|
-
const accountId = account.id();
|
|
993
|
-
if (isFaucetId(accountId)) {
|
|
994
|
-
faucets.push(account);
|
|
995
|
-
} else {
|
|
996
|
-
wallets.push(account);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
973
|
return {
|
|
1000
974
|
accounts,
|
|
1001
|
-
wallets,
|
|
1002
|
-
faucets,
|
|
975
|
+
wallets: accounts,
|
|
976
|
+
faucets: [],
|
|
1003
977
|
isLoading: isLoadingAccounts,
|
|
1004
978
|
error: null,
|
|
1005
979
|
refetch
|
|
@@ -1034,7 +1008,6 @@ var getRpcClient = (rpcUrl) => {
|
|
|
1034
1008
|
var fetchAssetMetadata = async (rpcClient, assetId) => {
|
|
1035
1009
|
try {
|
|
1036
1010
|
const accountId = parseAccountId(assetId);
|
|
1037
|
-
if (!isFaucetId(accountId)) return null;
|
|
1038
1011
|
const fetched = await rpcClient.getAccountDetails(accountId);
|
|
1039
1012
|
const account = fetched.account?.();
|
|
1040
1013
|
if (!account) return null;
|
|
@@ -1828,12 +1801,10 @@ function useCreateWallet() {
|
|
|
1828
1801
|
const storageMode = getStorageMode(
|
|
1829
1802
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1830
1803
|
);
|
|
1831
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1832
1804
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
1833
1805
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1834
1806
|
const createdWallet = await client.newWallet(
|
|
1835
1807
|
storageMode,
|
|
1836
|
-
mutable,
|
|
1837
1808
|
authScheme,
|
|
1838
1809
|
options.initSeed
|
|
1839
1810
|
);
|
|
@@ -2086,11 +2057,9 @@ function useImportAccount() {
|
|
|
2086
2057
|
return fetchedAccount;
|
|
2087
2058
|
}
|
|
2088
2059
|
case "seed": {
|
|
2089
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
2060
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
2091
2061
|
return await client.importPublicAccountFromSeed(
|
|
2092
2062
|
options.seed,
|
|
2093
|
-
mutable,
|
|
2094
2063
|
authScheme
|
|
2095
2064
|
);
|
|
2096
2065
|
}
|
|
@@ -3339,7 +3308,6 @@ function useSessionAccount(options) {
|
|
|
3339
3308
|
const pollIntervalMs = options.pollIntervalMs ?? 3e3;
|
|
3340
3309
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3341
3310
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3342
|
-
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3343
3311
|
const authScheme = options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
3344
3312
|
const fundRef = useRef8(options.fund);
|
|
3345
3313
|
fundRef.current = options.fund;
|
|
@@ -3378,11 +3346,7 @@ function useSessionAccount(options) {
|
|
|
3378
3346
|
if (!walletId) {
|
|
3379
3347
|
setStep("creating");
|
|
3380
3348
|
const resolvedStorageMode = getStorageMode3(storageMode);
|
|
3381
|
-
const wallet = await client.newWallet(
|
|
3382
|
-
resolvedStorageMode,
|
|
3383
|
-
mutable,
|
|
3384
|
-
authScheme
|
|
3385
|
-
);
|
|
3349
|
+
const wallet = await client.newWallet(resolvedStorageMode, authScheme);
|
|
3386
3350
|
ensureAccountBech32(wallet);
|
|
3387
3351
|
const accounts = await client.getAccounts();
|
|
3388
3352
|
setAccounts(accounts);
|
|
@@ -3422,7 +3386,6 @@ function useSessionAccount(options) {
|
|
|
3422
3386
|
sync,
|
|
3423
3387
|
sessionAccountId,
|
|
3424
3388
|
storageMode,
|
|
3425
|
-
mutable,
|
|
3426
3389
|
authScheme,
|
|
3427
3390
|
storagePrefix,
|
|
3428
3391
|
pollIntervalMs,
|
package/dist/mt.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignerAccountType = "RegularAccountImmutableCode" | "RegularAccountUpdatabl
|
|
|
51
51
|
interface SignerAccountConfig {
|
|
52
52
|
/** Public key commitment (for auth component) */
|
|
53
53
|
publicKeyCommitment: Uint8Array;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Ignored as of protocol 0.15. Code mutability and faucet/wallet
|
|
56
|
+
* account types are no longer encoded in the account, so this value has no
|
|
57
|
+
* effect on the built account and is safe to omit.
|
|
58
|
+
*/
|
|
59
|
+
accountType?: SignerAccountType;
|
|
60
|
+
/** Storage mode (public or private) */
|
|
57
61
|
storageMode: AccountStorageMode;
|
|
58
62
|
/** Optional seed for deterministic account ID */
|
|
59
63
|
accountSeed?: Uint8Array;
|
|
@@ -196,7 +200,16 @@ interface SyncState {
|
|
|
196
200
|
}
|
|
197
201
|
interface AccountsResult {
|
|
198
202
|
accounts: AccountHeader[];
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Protocol 0.15 removed faucet-vs-wallet from the account id, so
|
|
205
|
+
* accounts can no longer be split from headers alone. `wallets` mirrors
|
|
206
|
+
* `accounts`. Use `accounts` and detect faucets per-account from its components.
|
|
207
|
+
*/
|
|
199
208
|
wallets: AccountHeader[];
|
|
209
|
+
/**
|
|
210
|
+
* @deprecated Always empty as of protocol 0.15 (see `wallets`). Detect faucets
|
|
211
|
+
* per-account from its components instead.
|
|
212
|
+
*/
|
|
200
213
|
faucets: AccountHeader[];
|
|
201
214
|
isLoading: boolean;
|
|
202
215
|
error: Error | null;
|
|
@@ -273,8 +286,6 @@ interface NoteSummary {
|
|
|
273
286
|
interface CreateWalletOptions {
|
|
274
287
|
/** Storage mode. Default: private */
|
|
275
288
|
storageMode?: StorageMode;
|
|
276
|
-
/** Whether code can be updated. Default: true */
|
|
277
|
-
mutable?: boolean;
|
|
278
289
|
/** Auth scheme. Default: AuthScheme.AuthRpoFalcon512 */
|
|
279
290
|
authScheme?: AuthScheme;
|
|
280
291
|
/** Initial seed for deterministic account ID */
|
|
@@ -303,7 +314,6 @@ type ImportAccountOptions = {
|
|
|
303
314
|
} | {
|
|
304
315
|
type: "seed";
|
|
305
316
|
seed: Uint8Array;
|
|
306
|
-
mutable?: boolean;
|
|
307
317
|
authScheme?: AuthScheme;
|
|
308
318
|
};
|
|
309
319
|
interface SendOptions {
|
|
@@ -541,7 +551,6 @@ interface UseSessionAccountOptions {
|
|
|
541
551
|
/** Wallet creation options */
|
|
542
552
|
walletOptions?: {
|
|
543
553
|
storageMode?: "private" | "public";
|
|
544
|
-
mutable?: boolean;
|
|
545
554
|
authScheme?: AuthScheme;
|
|
546
555
|
};
|
|
547
556
|
/** Polling interval for funding note detection (ms). Default: 3000 */
|
|
@@ -570,7 +579,6 @@ declare const DEFAULTS: {
|
|
|
570
579
|
readonly RPC_URL: undefined;
|
|
571
580
|
readonly AUTO_SYNC_INTERVAL: 15000;
|
|
572
581
|
readonly STORAGE_MODE: "private";
|
|
573
|
-
readonly WALLET_MUTABLE: true;
|
|
574
582
|
readonly AUTH_SCHEME: AuthScheme.AuthRpoFalcon512;
|
|
575
583
|
readonly NOTE_TYPE: "private";
|
|
576
584
|
readonly FAUCET_DECIMALS: 8;
|
|
@@ -829,7 +837,6 @@ interface UseCreateWalletResult {
|
|
|
829
837
|
* const handleCreate = async () => {
|
|
830
838
|
* const newWallet = await createWallet({
|
|
831
839
|
* storageMode: 'private',
|
|
832
|
-
* mutable: true,
|
|
833
840
|
* });
|
|
834
841
|
* console.log('Created wallet:', newWallet.id().toString());
|
|
835
842
|
* };
|
package/dist/mt.mjs
CHANGED
|
@@ -177,19 +177,6 @@ var parseAccountId = (value) => {
|
|
|
177
177
|
}
|
|
178
178
|
return value;
|
|
179
179
|
};
|
|
180
|
-
function isFaucetId(accountId) {
|
|
181
|
-
try {
|
|
182
|
-
let hex = typeof accountId.toHex === "function" ? accountId.toHex() : String(accountId);
|
|
183
|
-
if (hex.startsWith("0x") || hex.startsWith("0X")) {
|
|
184
|
-
hex = hex.slice(2);
|
|
185
|
-
}
|
|
186
|
-
const firstByte = parseInt(hex.slice(0, 2), 16);
|
|
187
|
-
const accountType = firstByte >> 4 & 3;
|
|
188
|
-
return accountType === 2 || accountType === 3;
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
180
|
var parseAddress = (value, accountId) => {
|
|
194
181
|
if (typeof value !== "string") {
|
|
195
182
|
const resolvedId = accountId ?? parseAccountId(value);
|
|
@@ -315,7 +302,6 @@ var DEFAULTS = {
|
|
|
315
302
|
// Will use SDK's testnet default
|
|
316
303
|
AUTO_SYNC_INTERVAL: 15e3,
|
|
317
304
|
STORAGE_MODE: "private",
|
|
318
|
-
WALLET_MUTABLE: true,
|
|
319
305
|
AUTH_SCHEME: AuthScheme.AuthRpoFalcon512,
|
|
320
306
|
NOTE_TYPE: "private",
|
|
321
307
|
FAUCET_DECIMALS: 8
|
|
@@ -585,7 +571,6 @@ function MidenProvider({
|
|
|
585
571
|
}, [client, isReady, setSyncState]);
|
|
586
572
|
const signerIsConnected = signerContext?.isConnected ?? null;
|
|
587
573
|
const signerStoreName = signerContext?.storeName ?? null;
|
|
588
|
-
const signerAccountType = signerContext?.accountConfig?.accountType ?? null;
|
|
589
574
|
const signerStorageMode = signerContext?.accountConfig?.storageMode?.toString() ?? null;
|
|
590
575
|
useEffect(() => {
|
|
591
576
|
signCbRef.current = signerContext?.signCb ?? null;
|
|
@@ -719,12 +704,11 @@ function MidenProvider({
|
|
|
719
704
|
setSignerConnected,
|
|
720
705
|
signerIsConnected,
|
|
721
706
|
signerStoreName,
|
|
722
|
-
signerAccountType,
|
|
723
707
|
signerStorageMode,
|
|
724
708
|
wrappedSignCb
|
|
725
|
-
// Note: signerContext is intentionally NOT a dep
|
|
726
|
-
// (signerIsConnected, signerStoreName,
|
|
727
|
-
//
|
|
709
|
+
// Note: signerContext is intentionally NOT a dep. We use stable primitives
|
|
710
|
+
// (signerIsConnected, signerStoreName, signerStorageMode) to avoid
|
|
711
|
+
// re-running when the signer provider creates a new object ref.
|
|
728
712
|
// signCb changes are handled by the dedicated useEffect + signCbRef above,
|
|
729
713
|
// not by this effect.
|
|
730
714
|
]);
|
|
@@ -986,20 +970,10 @@ function useAccounts() {
|
|
|
986
970
|
refetch();
|
|
987
971
|
}
|
|
988
972
|
}, [isReady, accounts.length, refetch]);
|
|
989
|
-
const wallets = [];
|
|
990
|
-
const faucets = [];
|
|
991
|
-
for (const account of accounts) {
|
|
992
|
-
const accountId = account.id();
|
|
993
|
-
if (isFaucetId(accountId)) {
|
|
994
|
-
faucets.push(account);
|
|
995
|
-
} else {
|
|
996
|
-
wallets.push(account);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
973
|
return {
|
|
1000
974
|
accounts,
|
|
1001
|
-
wallets,
|
|
1002
|
-
faucets,
|
|
975
|
+
wallets: accounts,
|
|
976
|
+
faucets: [],
|
|
1003
977
|
isLoading: isLoadingAccounts,
|
|
1004
978
|
error: null,
|
|
1005
979
|
refetch
|
|
@@ -1034,7 +1008,6 @@ var getRpcClient = (rpcUrl) => {
|
|
|
1034
1008
|
var fetchAssetMetadata = async (rpcClient, assetId) => {
|
|
1035
1009
|
try {
|
|
1036
1010
|
const accountId = parseAccountId(assetId);
|
|
1037
|
-
if (!isFaucetId(accountId)) return null;
|
|
1038
1011
|
const fetched = await rpcClient.getAccountDetails(accountId);
|
|
1039
1012
|
const account = fetched.account?.();
|
|
1040
1013
|
if (!account) return null;
|
|
@@ -1828,12 +1801,10 @@ function useCreateWallet() {
|
|
|
1828
1801
|
const storageMode = getStorageMode(
|
|
1829
1802
|
options.storageMode ?? DEFAULTS.STORAGE_MODE
|
|
1830
1803
|
);
|
|
1831
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
1832
1804
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
1833
1805
|
const newWallet = await runExclusiveSafe(async () => {
|
|
1834
1806
|
const createdWallet = await client.newWallet(
|
|
1835
1807
|
storageMode,
|
|
1836
|
-
mutable,
|
|
1837
1808
|
authScheme,
|
|
1838
1809
|
options.initSeed
|
|
1839
1810
|
);
|
|
@@ -2086,11 +2057,9 @@ function useImportAccount() {
|
|
|
2086
2057
|
return fetchedAccount;
|
|
2087
2058
|
}
|
|
2088
2059
|
case "seed": {
|
|
2089
|
-
const mutable = options.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
2090
2060
|
const authScheme = options.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
2091
2061
|
return await client.importPublicAccountFromSeed(
|
|
2092
2062
|
options.seed,
|
|
2093
|
-
mutable,
|
|
2094
2063
|
authScheme
|
|
2095
2064
|
);
|
|
2096
2065
|
}
|
|
@@ -3339,7 +3308,6 @@ function useSessionAccount(options) {
|
|
|
3339
3308
|
const pollIntervalMs = options.pollIntervalMs ?? 3e3;
|
|
3340
3309
|
const maxWaitMs = options.maxWaitMs ?? 6e4;
|
|
3341
3310
|
const storageMode = options.walletOptions?.storageMode ?? "public";
|
|
3342
|
-
const mutable = options.walletOptions?.mutable ?? DEFAULTS.WALLET_MUTABLE;
|
|
3343
3311
|
const authScheme = options.walletOptions?.authScheme ?? DEFAULTS.AUTH_SCHEME;
|
|
3344
3312
|
const fundRef = useRef8(options.fund);
|
|
3345
3313
|
fundRef.current = options.fund;
|
|
@@ -3378,11 +3346,7 @@ function useSessionAccount(options) {
|
|
|
3378
3346
|
if (!walletId) {
|
|
3379
3347
|
setStep("creating");
|
|
3380
3348
|
const resolvedStorageMode = getStorageMode3(storageMode);
|
|
3381
|
-
const wallet = await client.newWallet(
|
|
3382
|
-
resolvedStorageMode,
|
|
3383
|
-
mutable,
|
|
3384
|
-
authScheme
|
|
3385
|
-
);
|
|
3349
|
+
const wallet = await client.newWallet(resolvedStorageMode, authScheme);
|
|
3386
3350
|
ensureAccountBech32(wallet);
|
|
3387
3351
|
const accounts = await client.getAccounts();
|
|
3388
3352
|
setAccounts(accounts);
|
|
@@ -3422,7 +3386,6 @@ function useSessionAccount(options) {
|
|
|
3422
3386
|
sync,
|
|
3423
3387
|
sessionAccountId,
|
|
3424
3388
|
storageMode,
|
|
3425
|
-
mutable,
|
|
3426
3389
|
authScheme,
|
|
3427
3390
|
storagePrefix,
|
|
3428
3391
|
pollIntervalMs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miden-sdk/react",
|
|
3
|
-
"version": "0.15.0
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "React hooks library for Miden Web Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"CLAUDE.md"
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@miden-sdk/miden-sdk": "^0.15.0
|
|
35
|
+
"@miden-sdk/miden-sdk": "^0.15.0",
|
|
36
36
|
"react": ">=18.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"tsup": "^8.0.0",
|
|
53
53
|
"typescript": "^5.0.0",
|
|
54
54
|
"vitest": "^3.0.0",
|
|
55
|
-
"@miden-sdk/miden-sdk": "0.15.0
|
|
55
|
+
"@miden-sdk/miden-sdk": "0.15.0"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"miden",
|