diff --git a/src/app/common/account-restoration/legacy-gaia-config-lookup.ts b/src/app/common/account-restoration/legacy-gaia-config-lookup.ts deleted file mode 100644 index 5a88b21e5e9..00000000000 --- a/src/app/common/account-restoration/legacy-gaia-config-lookup.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - connectToGaiaHubWithConfig, - fetchWalletConfig, - generateWallet, - getHubInfo, -} from '@stacks/wallet-sdk'; - -import { gaiaUrl as gaiaHubUrl } from '@shared/constants'; - -// This function replicates behaviour wrapped in the `restoreWalletAccounts` -// method of wallet-sdk. It checks for BNS names on Gaia-persisted accounts, -// resulting in a huge number of requests when called by a wallet with many -// accounts. Here, we only care to find the number of accounts a user has -// generated, with no other side effects. -export async function checkForLegacyGaiaConfigWithKnownGeneratedAccountIndex(secretKey: string) { - try { - const wallet = await generateWallet({ secretKey, password: '' }); - const hubInfo = await getHubInfo(gaiaHubUrl); - const currentGaiaConfig = connectToGaiaHubWithConfig({ - hubInfo, - privateKey: wallet.configPrivateKey, - gaiaHubUrl, - }); - const resp = await fetchWalletConfig({ wallet, gaiaHubConfig: currentGaiaConfig }); - return resp?.accounts.length ? resp.accounts.length - 1 : 0; - } catch (e) { - return 0; - } -} diff --git a/src/app/store/software-keys/software-key.actions.ts b/src/app/store/software-keys/software-key.actions.ts index b244c4dc627..e4319201126 100644 --- a/src/app/store/software-keys/software-key.actions.ts +++ b/src/app/store/software-keys/software-key.actions.ts @@ -14,7 +14,6 @@ import { defaultWalletKeyId } from '@shared/utils'; import { identifyUser } from '@shared/utils/analytics'; import { recurseAccountsForActivity } from '@app/common/account-restoration/account-restore'; -import { checkForLegacyGaiaConfigWithKnownGeneratedAccountIndex } from '@app/common/account-restoration/legacy-gaia-config-lookup'; import { mnemonicToRootNode } from '@app/common/keychain/keychain'; import { queryClient } from '@app/common/persistence'; import { AppThunk } from '@app/store'; @@ -47,9 +46,6 @@ function setWalletEncryptionPassword(args: { await initalizeWalletSession(encryptionKey); - const legacyAccountActivityLookup = - await checkForLegacyGaiaConfigWithKnownGeneratedAccountIndex(secretKey); - async function doesStacksAddressHaveBalance(address: string) { const controller = new AbortController(); const resp = await stxClient.getAccountBalance(address, controller.signal); @@ -95,7 +91,6 @@ function setWalletEncryptionPassword(args: { return hasStxBalance || hasNames || hasBtcBalance; }, }).then(recursiveActivityIndex => { - if (recursiveActivityIndex <= legacyAccountActivityLookup) return; logger.info('Found account activity at higher index', { recursiveActivityIndex }); dispatch(stxChainSlice.actions.restoreAccountIndex(recursiveActivityIndex)); }); @@ -111,8 +106,6 @@ function setWalletEncryptionPassword(args: { encryptedSecretKey, }) ); - if (legacyAccountActivityLookup !== 0) - dispatch(stxChainSlice.actions.restoreAccountIndex(legacyAccountActivityLookup)); }; } diff --git a/src/shared/constants.ts b/src/shared/constants.ts index d82ad2f07e1..ec4253c3a3a 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -1,5 +1,3 @@ -export const gaiaUrl = 'https://hub.blockstack.org'; - export const ZERO_INDEX = 0; export const GITHUB_ORG = 'leather-io';