@openfort/react-native 0.1.25 → 0.1.26
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.
|
@@ -106,12 +106,16 @@ export function useEmbeddedEthereumWallet(options = {}) {
|
|
|
106
106
|
status: 'idle',
|
|
107
107
|
});
|
|
108
108
|
// Fetch Ethereum embedded accounts
|
|
109
|
-
const fetchEmbeddedAccounts = useCallback(async () => {
|
|
109
|
+
const fetchEmbeddedAccounts = useCallback(async (options) => {
|
|
110
110
|
if (!client || embeddedState === EmbeddedState.NONE || embeddedState === EmbeddedState.UNAUTHENTICATED) {
|
|
111
111
|
setEmbeddedAccounts([]);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
|
+
// Only set fetching status if not called silently (e.g., during create/setActive)
|
|
116
|
+
if (!options?.silent) {
|
|
117
|
+
setStatus({ status: 'fetching-wallets' });
|
|
118
|
+
}
|
|
115
119
|
const accounts = await client.embeddedWallet.list({
|
|
116
120
|
limit: 100,
|
|
117
121
|
chainType: ChainTypeEnum.EVM,
|
|
@@ -119,9 +123,15 @@ export function useEmbeddedEthereumWallet(options = {}) {
|
|
|
119
123
|
});
|
|
120
124
|
// Filter for Ethereum accounts only
|
|
121
125
|
setEmbeddedAccounts(accounts);
|
|
126
|
+
if (!options?.silent) {
|
|
127
|
+
setStatus({ status: 'idle' });
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
catch {
|
|
124
131
|
setEmbeddedAccounts([]);
|
|
132
|
+
if (!options?.silent) {
|
|
133
|
+
setStatus({ status: 'idle' });
|
|
134
|
+
}
|
|
125
135
|
}
|
|
126
136
|
}, [client, embeddedState, walletConfig]);
|
|
127
137
|
useEffect(() => {
|
|
@@ -263,8 +273,8 @@ export function useEmbeddedEthereumWallet(options = {}) {
|
|
|
263
273
|
// Get provider
|
|
264
274
|
const ethProvider = await getEthereumProvider();
|
|
265
275
|
setProvider(ethProvider);
|
|
266
|
-
// Refresh accounts and set as active
|
|
267
|
-
await fetchEmbeddedAccounts();
|
|
276
|
+
// Refresh accounts silently (don't override 'creating' status) and set as active
|
|
277
|
+
await fetchEmbeddedAccounts({ silent: true });
|
|
268
278
|
setActiveWalletId(embeddedAccount.id);
|
|
269
279
|
setActiveAccount(embeddedAccount);
|
|
270
280
|
setStatus({ status: 'success' });
|
|
@@ -476,6 +486,9 @@ export function useEmbeddedEthereumWallet(options = {}) {
|
|
|
476
486
|
exportPrivateKey: client.embeddedWallet.exportPrivateKey,
|
|
477
487
|
};
|
|
478
488
|
// Priority 1: Explicit action states (user-initiated operations)
|
|
489
|
+
if (status.status === 'fetching-wallets') {
|
|
490
|
+
return { ...baseActions, status: 'fetching-wallets', activeWallet: null };
|
|
491
|
+
}
|
|
479
492
|
if (status.status === 'creating') {
|
|
480
493
|
return { ...baseActions, status: 'creating', activeWallet: null };
|
|
481
494
|
}
|
|
@@ -117,21 +117,31 @@ export function useEmbeddedSolanaWallet(options = {}) {
|
|
|
117
117
|
status: 'idle',
|
|
118
118
|
});
|
|
119
119
|
// Fetch Solana embedded accounts
|
|
120
|
-
const fetchEmbeddedAccounts = useCallback(async () => {
|
|
120
|
+
const fetchEmbeddedAccounts = useCallback(async (options) => {
|
|
121
121
|
if (!client || embeddedState === EmbeddedState.NONE || embeddedState === EmbeddedState.UNAUTHENTICATED) {
|
|
122
122
|
setEmbeddedAccounts([]);
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
try {
|
|
126
|
+
// Only set fetching status if not called silently (e.g., during create/setActive)
|
|
127
|
+
if (!options?.silent) {
|
|
128
|
+
setStatus({ status: 'fetching-wallets' });
|
|
129
|
+
}
|
|
126
130
|
const accounts = await client.embeddedWallet.list({
|
|
127
131
|
chainType: ChainTypeEnum.SVM,
|
|
128
132
|
accountType: AccountTypeEnum.EOA,
|
|
129
133
|
limit: 100,
|
|
130
134
|
});
|
|
131
135
|
setEmbeddedAccounts(accounts);
|
|
136
|
+
if (!options?.silent) {
|
|
137
|
+
setStatus({ status: 'idle' });
|
|
138
|
+
}
|
|
132
139
|
}
|
|
133
140
|
catch {
|
|
134
141
|
setEmbeddedAccounts([]);
|
|
142
|
+
if (!options?.silent) {
|
|
143
|
+
setStatus({ status: 'idle' });
|
|
144
|
+
}
|
|
135
145
|
}
|
|
136
146
|
}, [client, embeddedState]);
|
|
137
147
|
useEffect(() => {
|
|
@@ -280,8 +290,8 @@ export function useEmbeddedSolanaWallet(options = {}) {
|
|
|
280
290
|
// Get provider
|
|
281
291
|
const solProvider = await getSolanaProvider(embeddedAccount);
|
|
282
292
|
setProvider(solProvider);
|
|
283
|
-
// Refresh accounts and set as active
|
|
284
|
-
await fetchEmbeddedAccounts();
|
|
293
|
+
// Refresh accounts silently (don't override 'creating' status) and set as active
|
|
294
|
+
await fetchEmbeddedAccounts({ silent: true });
|
|
285
295
|
setActiveWalletId(embeddedAccount.id);
|
|
286
296
|
setActiveAccount(embeddedAccount);
|
|
287
297
|
setStatus({ status: 'success' });
|
|
@@ -426,6 +436,9 @@ export function useEmbeddedSolanaWallet(options = {}) {
|
|
|
426
436
|
setActive,
|
|
427
437
|
};
|
|
428
438
|
// Priority 1: Explicit action states (user-initiated operations)
|
|
439
|
+
if (status.status === 'fetching-wallets') {
|
|
440
|
+
return { ...baseActions, status: 'fetching-wallets', activeWallet: null };
|
|
441
|
+
}
|
|
429
442
|
if (status.status === 'creating') {
|
|
430
443
|
return { ...baseActions, status: 'creating', activeWallet: null };
|
|
431
444
|
}
|
|
@@ -266,6 +266,9 @@ export interface SolanaWalletActions {
|
|
|
266
266
|
export type EmbeddedEthereumWalletState = (EthereumWalletActions & {
|
|
267
267
|
status: 'disconnected';
|
|
268
268
|
activeWallet: null;
|
|
269
|
+
}) | (EthereumWalletActions & {
|
|
270
|
+
status: 'fetching-wallets';
|
|
271
|
+
activeWallet: null;
|
|
269
272
|
}) | (EthereumWalletActions & {
|
|
270
273
|
status: 'connecting';
|
|
271
274
|
activeWallet: ConnectedEmbeddedEthereumWallet;
|
|
@@ -293,6 +296,9 @@ export type EmbeddedEthereumWalletState = (EthereumWalletActions & {
|
|
|
293
296
|
export type EmbeddedSolanaWalletState = (SolanaWalletActions & {
|
|
294
297
|
status: 'disconnected';
|
|
295
298
|
activeWallet: null;
|
|
299
|
+
}) | (SolanaWalletActions & {
|
|
300
|
+
status: 'fetching-wallets';
|
|
301
|
+
activeWallet: null;
|
|
296
302
|
}) | (SolanaWalletActions & {
|
|
297
303
|
status: 'connecting';
|
|
298
304
|
}) | (SolanaWalletActions & {
|
package/package.json
CHANGED