From 68a270e2b567209685768aa42a2e94281ccc29a0 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Mon, 25 Nov 2024 16:23:28 +0200 Subject: [PATCH] Update getAddress --- src/core/methods/account/getIsLoggedIn.ts | 1 - .../DappProvider/helpers/logout/logout.ts | 11 +++++----- .../helpers/signMessage/signMessage.ts | 6 ++--- src/core/providers/ProviderFactory.ts | 22 +++++++++---------- src/core/providers/helpers/restoreProvider.ts | 6 ++--- src/utils/account/refreshAccount.ts | 2 +- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/core/methods/account/getIsLoggedIn.ts b/src/core/methods/account/getIsLoggedIn.ts index 9316522..8e04a1f 100644 --- a/src/core/methods/account/getIsLoggedIn.ts +++ b/src/core/methods/account/getIsLoggedIn.ts @@ -1,5 +1,4 @@ import { isLoggedInSelector } from 'store/selectors/accountSelectors'; -import { getAddress } from './getAddress'; import { getState } from 'store/store'; export function getIsLoggedIn() { diff --git a/src/core/providers/DappProvider/helpers/logout/logout.ts b/src/core/providers/DappProvider/helpers/logout/logout.ts index de91aae..2e6476c 100644 --- a/src/core/providers/DappProvider/helpers/logout/logout.ts +++ b/src/core/providers/DappProvider/helpers/logout/logout.ts @@ -1,14 +1,13 @@ -import { storage } from 'storage'; -import { localStorageKeys } from 'storage/local'; -import { getAddress } from '../../../../methods/account/getAddress'; -import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider'; -import { logoutAction } from 'store/actions/sharedActions/sharedActions'; -import { getAccountProvider } from 'core/providers/accountProvider'; +import { getAddress } from 'core/methods/account/getAddress'; import { getProviderType } from 'core/providers/helpers/utils'; import { IProvider, ProviderTypeEnum } from 'core/providers/types/providerFactory.types'; +import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider'; +import { storage } from 'storage'; +import { localStorageKeys } from 'storage/local'; +import { logoutAction } from 'store/actions/sharedActions/sharedActions'; const broadcastLogoutAcrossTabs = (address: string) => { const storedData = storage.local?.getItem(localStorageKeys.logoutEvent); diff --git a/src/core/providers/DappProvider/helpers/signMessage/signMessage.ts b/src/core/providers/DappProvider/helpers/signMessage/signMessage.ts index ef7c1ab..7cf3e8e 100644 --- a/src/core/providers/DappProvider/helpers/signMessage/signMessage.ts +++ b/src/core/providers/DappProvider/helpers/signMessage/signMessage.ts @@ -1,12 +1,12 @@ import { Message, Address } from '@multiversx/sdk-core'; +import { getAddress } from 'core/methods/account/getAddress'; import { getProviderType } from 'core/providers/helpers/utils'; -import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider'; -import { Nullable } from 'types'; import { IProvider, ProviderTypeEnum } from 'core/providers/types/providerFactory.types'; -import { getAddress } from 'core/methods/account/getAddress'; +import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider'; +import { Nullable } from 'types'; export type SignMessageType = { provider: IProvider; diff --git a/src/core/providers/ProviderFactory.ts b/src/core/providers/ProviderFactory.ts index a35b25c..0b5251d 100644 --- a/src/core/providers/ProviderFactory.ts +++ b/src/core/providers/ProviderFactory.ts @@ -1,19 +1,19 @@ +import { IframeLoginTypes } from '@multiversx/sdk-web-wallet-iframe-provider/out/constants'; +import { SECOND_LOGIN_ATTEMPT_ERROR } from 'constants/errorMessages.constants'; +import { getAddress } from 'core/methods/account/getAddress'; +import { getIsLoggedIn } from 'core/methods/account/getIsLoggedIn'; +import { setProviderType } from 'store/actions/loginInfo/loginInfoActions'; +import { setAccountProvider } from './accountProvider'; +import { DappProvider } from './DappProvider/DappProvider'; +import { createCrossWindowProvider } from './helpers/crossWindow/createCrossWindowProvider'; +import { createExtensionProvider } from './helpers/extension/createExtensionProvider'; +import { createIframeProvider } from './helpers/iframe/createIframeProvider'; +import { createLedgerProvider } from './helpers/ledger/createLedgerProvider'; import { IProvider, IProviderFactory, ProviderTypeEnum } from './types/providerFactory.types'; -import { createLedgerProvider } from './helpers/ledger/createLedgerProvider'; -import { createCrossWindowProvider } from './helpers/crossWindow/createCrossWindowProvider'; -import { createExtensionProvider } from './helpers/extension/createExtensionProvider'; -import { createIframeProvider } from './helpers/iframe/createIframeProvider'; -import { IframeLoginTypes } from '@multiversx/sdk-web-wallet-iframe-provider/out/constants'; -import { getIsLoggedIn } from 'core/methods/account/getIsLoggedIn'; -import { getAddress } from 'core/methods/account/getAddress'; -import { SECOND_LOGIN_ATTEMPT_ERROR } from 'constants/errorMessages.constants'; -import { setAccountProvider } from './accountProvider'; -import { setProviderType } from 'store/actions/loginInfo/loginInfoActions'; -import { DappProvider } from './DappProvider/DappProvider'; export class ProviderFactory { public async create({ diff --git a/src/core/providers/helpers/restoreProvider.ts b/src/core/providers/helpers/restoreProvider.ts index f53e167..3e352ef 100644 --- a/src/core/providers/helpers/restoreProvider.ts +++ b/src/core/providers/helpers/restoreProvider.ts @@ -1,9 +1,9 @@ +import { getAddress } from 'core/methods/account/getAddress'; import { providerTypeSelector } from 'store/selectors'; -import { ProviderFactory } from '../ProviderFactory'; -import { IProviderConfig } from '../types/providerFactory.types'; import { getState } from 'store/store'; import { setAccountProvider } from '../accountProvider'; -import { getAddress } from 'core/methods/account/getAddress'; +import { ProviderFactory } from '../ProviderFactory'; +import { IProviderConfig } from '../types/providerFactory.types'; export async function restoreProvider() { const type = providerTypeSelector(getState()); diff --git a/src/utils/account/refreshAccount.ts b/src/utils/account/refreshAccount.ts index 1134fcd..42f2503 100644 --- a/src/utils/account/refreshAccount.ts +++ b/src/utils/account/refreshAccount.ts @@ -1,8 +1,8 @@ import { getAddress } from 'core/methods/account/getAddress'; -import { fetchAccount } from './fetchAccount'; import { getLatestNonce } from 'core/methods/account/getLatestNonce'; import { getAccountProvider } from 'core/providers/accountProvider'; import { setAccount } from 'store/actions'; +import { fetchAccount } from './fetchAccount'; const setNewAccount = async () => { try {