Fix wallet selection
This commit is contained in:
parent
cc9d882ffe
commit
275801931e
|
@ -241,6 +241,7 @@ function NetworkSelector() {
|
|||
function WalletSelector() {
|
||||
const {
|
||||
accounts,
|
||||
derivedAccounts,
|
||||
hardwareWalletAccount,
|
||||
setHardwareWalletAccount,
|
||||
setWalletSelector,
|
||||
|
@ -290,7 +291,7 @@ function WalletSelector() {
|
|||
onAdd={({ name, importedAccount }) => {
|
||||
addAccount({ name, importedAccount });
|
||||
setWalletSelector({
|
||||
walletIndex: importedAccount ? undefined : accounts.length,
|
||||
walletIndex: importedAccount ? undefined : derivedAccounts.length,
|
||||
importedPubkey: importedAccount
|
||||
? importedAccount.publicKey.toString()
|
||||
: undefined,
|
||||
|
|
|
@ -280,7 +280,7 @@ export function WalletProvider({ children }) {
|
|||
}
|
||||
}
|
||||
|
||||
const accounts = useMemo(() => {
|
||||
const [accounts, derivedAccounts] = useMemo(() => {
|
||||
if (!seed) {
|
||||
return [];
|
||||
}
|
||||
|
@ -316,7 +316,8 @@ export function WalletProvider({ children }) {
|
|||
};
|
||||
});
|
||||
|
||||
return derivedAccounts.concat(importedAccounts);
|
||||
const accounts = derivedAccounts.concat(importedAccounts);
|
||||
return [accounts, derivedAccounts];
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [seed, walletCount, walletSelector, privateKeyImports, walletNames]);
|
||||
|
||||
|
@ -349,6 +350,7 @@ export function WalletProvider({ children }) {
|
|||
privateKeyImports,
|
||||
setPrivateKeyImports,
|
||||
accounts,
|
||||
derivedAccounts,
|
||||
addAccount,
|
||||
setAccountName,
|
||||
derivationPath,
|
||||
|
@ -466,6 +468,7 @@ export function useBalanceInfo(publicKey) {
|
|||
export function useWalletSelector() {
|
||||
const {
|
||||
accounts,
|
||||
derivedAccounts,
|
||||
addAccount,
|
||||
setWalletSelector,
|
||||
setAccountName,
|
||||
|
@ -475,6 +478,7 @@ export function useWalletSelector() {
|
|||
|
||||
return {
|
||||
accounts,
|
||||
derivedAccounts,
|
||||
setWalletSelector,
|
||||
addAccount,
|
||||
setAccountName,
|
||||
|
|
Loading…
Reference in New Issue