|
|
@ -111,7 +111,6 @@ async function scanAccountsOnDeviceBySegwit({ |
|
|
|
|
|
|
|
// retrieve or create the wallet
|
|
|
|
const wallet = await getOrCreateWallet(core, walletName, { currency, derivationMode }) |
|
|
|
const accountsCount = await wallet.getAccountCount() |
|
|
|
|
|
|
|
// recursively scan all accounts on device on the given app
|
|
|
|
// new accounts will be created in sqlite, existing ones will be updated
|
|
|
@ -121,7 +120,6 @@ async function scanAccountsOnDeviceBySegwit({ |
|
|
|
walletName, |
|
|
|
devicePath, |
|
|
|
currency, |
|
|
|
accountsCount, |
|
|
|
accountIndex: 0, |
|
|
|
accounts: [], |
|
|
|
onAccountScanned, |
|
|
@ -202,7 +200,6 @@ async function scanNextAccount(props: { |
|
|
|
currency: CryptoCurrency, |
|
|
|
seedIdentifier: string, |
|
|
|
derivationMode: string, |
|
|
|
accountsCount: number, |
|
|
|
accountIndex: number, |
|
|
|
accounts: AccountRaw[], |
|
|
|
onAccountScanned: AccountRaw => void, |
|
|
@ -215,7 +212,6 @@ async function scanNextAccount(props: { |
|
|
|
walletName, |
|
|
|
devicePath, |
|
|
|
currency, |
|
|
|
accountsCount, |
|
|
|
accountIndex, |
|
|
|
accounts, |
|
|
|
onAccountScanned, |
|
|
@ -225,13 +221,12 @@ async function scanNextAccount(props: { |
|
|
|
isUnsubscribed, |
|
|
|
} = props |
|
|
|
|
|
|
|
// create account only if account has not been scanned yet
|
|
|
|
// if it has already been created, we just need to get it, and sync it
|
|
|
|
const hasBeenScanned = accountIndex < accountsCount |
|
|
|
|
|
|
|
const njsAccount = hasBeenScanned |
|
|
|
? await wallet.getAccount(accountIndex) |
|
|
|
: await createAccount(wallet, devicePath) |
|
|
|
let njsAccount |
|
|
|
try { |
|
|
|
njsAccount = await wallet.getAccount(accountIndex) |
|
|
|
} catch (err) { |
|
|
|
njsAccount = await createAccount(wallet, devicePath) |
|
|
|
} |
|
|
|
|
|
|
|
if (isUnsubscribed()) return [] |
|
|
|
|
|
|
|