Skip to content

Commit

Permalink
fix: mf-4655 name of recovery wallet (#10353)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill committed Aug 11, 2023
1 parent 60b7cb2 commit 2912c23
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ import { fromBase64URL, type EC_JsonWebKey, isK256Point, isK256PrivateKey } from
import { WalletServiceRef } from '@masknet/plugin-infra/dom'

export async function internal_wallet_restore(backup: NormalizedBackup.WalletBackup[]) {
let index = 0
for (const wallet of backup) {
try {
const wallets = await WalletServiceRef.value.getWallets()
const nameExists = wallets.some((x) => x.name === wallet.name)
const name = nameExists ? `Wallet ${wallets.length + 1}` : wallet.name
index += 1
let name = wallet.name
if (nameExists) {
name = `${wallet.name}(2)`
} else {
name ||= `Wallet ${index + wallets.length}`
}

if (wallet.privateKey.some)
await WalletServiceRef.value.recoverWalletFromPrivateKey(
Expand Down

0 comments on commit 2912c23

Please sign in to comment.