Skip to content

Commit

Permalink
Merge pull request #3108 from near/wallet-migration-skip-rotate-key
Browse files Browse the repository at this point in the history
Wallet Migration skip Key rotation step
  • Loading branch information
hcho112 committed Nov 19, 2023
2 parents 45b7de9 + 74c25ad commit d340c41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ const WalletMigration = ({ open, onClose }) => {
setIsLoggingOut(true);
const failedAccounts = [];
for (const accountId of availableAccounts) {
const publicKey = await wallet.getPublicKey(accountId);
try {
const account = await wallet.getAccount(accountId);
await account.deleteKey(publicKey);
await wallet.removeWalletAccount(accountId);
} catch {
failedAccounts.push(accountIdToHash(accountId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const Disable2FAModal = ({ handleSetActiveView, onClose, accountWithDetails, set

useEffect(() => {
if (completedWithSuccess) {
handleSetActiveView(WALLET_MIGRATION_VIEWS.ROTATE_KEYS);
handleSetActiveView(WALLET_MIGRATION_VIEWS.MIGRATE_ACCOUNTS);
}
}, [completedWithSuccess]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';

import { wallet } from '../../../../utils/wallet';
import { WalletSelectorContent } from './WalletSelectorContent';
import { ExportAccountSelectorContextProvider } from './WalletSelectorExportContext';

Expand All @@ -9,11 +10,7 @@ export const WalletSelectorModal = ({ onComplete, migrationAccounts, network, ro
const init = async () => {
const accountsWithKey = await Promise.all(migrationAccounts.map(async (account) => {
const accountId = account.accountId;
const privateKey = rotatedKeys[accountId];
if (!privateKey) {
throw new Error('Unable to find a private key from the rotated keys');
}

const privateKey = await wallet.getLocalSecretKey(accountId);
return {
accountId,
privateKey,
Expand Down

0 comments on commit d340c41

Please sign in to comment.