diff --git a/suite-common/assets/src/tests/assets.test.ts b/suite-common/assets/src/tests/assets.test.ts index 615e18fc22e..6e2ddafd871 100644 --- a/suite-common/assets/src/tests/assets.test.ts +++ b/suite-common/assets/src/tests/assets.test.ts @@ -1,5 +1,5 @@ -import * as fixtures from './fixtures/assets'; import { calculateAssetsPercentage } from '../utils'; +import * as fixtures from './fixtures/assets'; describe('calculateAssetsPercentage', () => { it('calculateAssetsPercentage - zero balance', () => { diff --git a/suite-common/connect-init/src/connectInitThunks.ts b/suite-common/connect-init/src/connectInitThunks.ts index 6a06b0b854e..a96a96e1098 100644 --- a/suite-common/connect-init/src/connectInitThunks.ts +++ b/suite-common/connect-init/src/connectInitThunks.ts @@ -1,4 +1,5 @@ import { createThunk } from '@suite-common/redux-utils'; +import { deviceConnectThunks } from '@suite-common/wallet-core'; import TrezorConnect, { BLOCKCHAIN_EVENT, DEVICE, @@ -6,10 +7,9 @@ import TrezorConnect, { TRANSPORT_EVENT, UI_EVENT, } from '@trezor/connect'; +import { isDesktop, isNative } from '@trezor/env-utils'; import { DATA_URL } from '@trezor/urls'; import { getSynchronize } from '@trezor/utils'; -import { deviceConnectThunks } from '@suite-common/wallet-core'; -import { isDesktop, isNative } from '@trezor/env-utils'; import { cardanoConnectPatch } from './cardanoConnectPatch'; diff --git a/suite-common/device-authenticity/src/deviceAuthenticityThunks.ts b/suite-common/device-authenticity/src/deviceAuthenticityThunks.ts index 327d567163d..b6c89b9da11 100644 --- a/suite-common/device-authenticity/src/deviceAuthenticityThunks.ts +++ b/suite-common/device-authenticity/src/deviceAuthenticityThunks.ts @@ -1,6 +1,6 @@ -import TrezorConnect, { AuthenticateDeviceResult } from '@trezor/connect'; import { createThunk } from '@suite-common/redux-utils'; -import { notificationsActions, ToastPayload } from '@suite-common/toast-notifications'; +import { ToastPayload, notificationsActions } from '@suite-common/toast-notifications'; +import TrezorConnect, { AuthenticateDeviceResult } from '@trezor/connect'; import { ACTION_PREFIX, deviceAuthenticityActions } from './deviceAuthenticityActions'; diff --git a/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts b/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts index 3a3cf8460e4..e8e902fba85 100644 --- a/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts +++ b/suite-common/device-authenticity/tests/deviceAuthenticityThunks.test.ts @@ -1,6 +1,6 @@ import { TrezorDevice } from '@suite-common/suite-types'; -import { notificationsActions } from '@suite-common/toast-notifications'; import { configureMockStore, testMocks } from '@suite-common/test-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { deviceAuthenticityActions } from '../src/deviceAuthenticityActions'; import { checkDeviceAuthenticityThunk } from '../src/deviceAuthenticityThunks'; diff --git a/suite-common/fiat-services/src/blockbook.ts b/suite-common/fiat-services/src/blockbook.ts index 1abdd49a486..b11aa2ac5b5 100644 --- a/suite-common/fiat-services/src/blockbook.ts +++ b/suite-common/fiat-services/src/blockbook.ts @@ -1,7 +1,7 @@ import type { HistoricRates, TimestampedRates } from '@suite-common/wallet-types'; -import { RateLimiter } from './limiter'; import { fetchUrl } from './fetch'; +import { RateLimiter } from './limiter'; // TODO: generate from @trezor/connect-common/files/coins.json const ENDPOINTS = { diff --git a/suite-common/fiat-services/src/coingecko.ts b/suite-common/fiat-services/src/coingecko.ts index 8e24d4007da..e65e8be95a5 100644 --- a/suite-common/fiat-services/src/coingecko.ts +++ b/suite-common/fiat-services/src/coingecko.ts @@ -1,10 +1,10 @@ +import { FiatCurrencyCode } from '@suite-common/suite-config'; import { networks } from '@suite-common/wallet-config'; import { HistoricRates, TickerId } from '@suite-common/wallet-types'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; import { parseAsset } from '@trezor/blockchain-link-utils/src/blockfrost'; -import { RateLimiter } from './limiter'; import { fetchUrl } from './fetch'; +import { RateLimiter } from './limiter'; // a proxy for https://api.coingecko.com/api/v3 const COINGECKO_API_BASE_URL = 'https://cdn.trezor.io/dynamic/coingecko/api/v3'; diff --git a/suite-common/fiat-services/src/rates.ts b/suite-common/fiat-services/src/rates.ts index 135de585afe..95901230c67 100644 --- a/suite-common/fiat-services/src/rates.ts +++ b/suite-common/fiat-services/src/rates.ts @@ -1,19 +1,19 @@ import { getUnixTime, subWeeks } from 'date-fns'; +import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { isBlockbookBasedNetwork } from '@suite-common/wallet-config'; import type { - TickerId, + FiatRatesResult, HistoricRates, + TickerId, Timestamp, - FiatRatesResult, } from '@suite-common/wallet-types'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; import TrezorConnect from '@trezor/connect'; import { scheduleAction } from '@trezor/utils'; -import { isBlockbookBasedNetwork } from '@suite-common/wallet-config'; -import * as coingeckoService from './coingecko'; import * as blockbookService from './blockbook'; import { ParallelRequestsCache } from './cache'; +import * as coingeckoService from './coingecko'; const CONNECT_FETCH_TIMEOUT = 10_000; diff --git a/suite-common/firmware/src/firmwareReducer.ts b/suite-common/firmware/src/firmwareReducer.ts index c0328871c63..9d9f634554a 100644 --- a/suite-common/firmware/src/firmwareReducer.ts +++ b/suite-common/firmware/src/firmwareReducer.ts @@ -1,15 +1,15 @@ +import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; import { FirmwareStatus, TrezorDevice } from '@suite-common/suite-types'; +import { isDeviceKnown } from '@suite-common/suite-utils'; +import { deviceActions } from '@suite-common/wallet-core'; import { - FirmwareType, - UI, DEVICE, + DeviceButtonRequest, FirmwareProgress, FirmwareReconnect, - DeviceButtonRequest, + FirmwareType, + UI, } from '@trezor/connect'; -import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; -import { deviceActions } from '@suite-common/wallet-core'; -import { isDeviceKnown } from '@suite-common/suite-utils'; import { firmwareActions } from './firmwareActions'; diff --git a/suite-common/firmware/src/firmwareThunks.ts b/suite-common/firmware/src/firmwareThunks.ts index a0145895088..036f96ba56e 100644 --- a/suite-common/firmware/src/firmwareThunks.ts +++ b/suite-common/firmware/src/firmwareThunks.ts @@ -1,11 +1,11 @@ -import { hasBitcoinOnlyFirmware, isBitcoinOnlyDevice } from '@trezor/device-utils'; -import TrezorConnect, { FirmwareType } from '@trezor/connect'; import { createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; import { selectSelectedDevice } from '@suite-common/wallet-core'; +import TrezorConnect, { FirmwareType } from '@trezor/connect'; +import { hasBitcoinOnlyFirmware, isBitcoinOnlyDevice } from '@trezor/device-utils'; -import { selectFirmware } from './firmwareReducer'; import { FIRMWARE_MODULE_PREFIX, firmwareActions } from './firmwareActions'; +import { selectFirmware } from './firmwareReducer'; import { getBinFilesBaseUrlThunk } from './getBinFilesBaseUrlThunk'; export const handleFwHashError = createThunk( diff --git a/suite-common/firmware/src/getBinFilesBaseUrlThunk.ts b/suite-common/firmware/src/getBinFilesBaseUrlThunk.ts index 702e0bbc4cb..b1fabdc6c94 100644 --- a/suite-common/firmware/src/getBinFilesBaseUrlThunk.ts +++ b/suite-common/firmware/src/getBinFilesBaseUrlThunk.ts @@ -1,6 +1,6 @@ -import { isDesktop } from '@trezor/env-utils'; -import { resolveConnectPath } from '@suite-common/suite-utils'; import { createThunk } from '@suite-common/redux-utils'; +import { resolveConnectPath } from '@suite-common/suite-utils'; +import { isDesktop } from '@trezor/env-utils'; import { FIRMWARE_MODULE_PREFIX } from './firmwareActions'; diff --git a/suite-common/firmware/src/hooks/useFirmwareInstallation.ts b/suite-common/firmware/src/hooks/useFirmwareInstallation.ts index 51519f4da09..dfc6275a96d 100644 --- a/suite-common/firmware/src/hooks/useFirmwareInstallation.ts +++ b/suite-common/firmware/src/hooks/useFirmwareInstallation.ts @@ -1,19 +1,19 @@ +import { useCallback, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { useMemo, useCallback } from 'react'; -import { FirmwareStatus, TrezorDevice } from '@suite-common/suite-types'; import { + firmwareActions, firmwareUpdate as firmwareUpdateThunk, selectFirmware, - firmwareActions, } from '@suite-common/firmware'; +import { FirmwareStatus, TrezorDevice } from '@suite-common/suite-types'; +import { selectSelectedDevice } from '@suite-common/wallet-core'; import { DEVICE, DeviceModelInternal, FirmwareType, UI } from '@trezor/connect'; import { getFirmwareVersion, hasBitcoinOnlyFirmware, isBitcoinOnlyDevice, } from '@trezor/device-utils'; -import { selectSelectedDevice } from '@suite-common/wallet-core'; /* There are three firmware update flows, depending on current firmware version: diff --git a/suite-common/formatters/src/FormatterProvider.tsx b/suite-common/formatters/src/FormatterProvider.tsx index 05f2278d6df..61324a64bc1 100644 --- a/suite-common/formatters/src/FormatterProvider.tsx +++ b/suite-common/formatters/src/FormatterProvider.tsx @@ -15,15 +15,15 @@ import { } from './formatters/prepareCryptoAmountFormatter'; import { prepareDateFormatter } from './formatters/prepareDateFormatter'; import { prepareDateTimeFormatter } from './formatters/prepareDateTimeFormatter'; +import { + DisplaySymbolFormatterDataContext, + prepareDisplaySymbolFormatter, +} from './formatters/prepareDisplaySymbolFormatter'; import { FiatAmountFormatterDataContext, prepareFiatAmountFormatter, } from './formatters/prepareFiatAmountFormatter'; import { MonthNameFormatter } from './formatters/prepareMonthNameFormatter'; -import { - DisplaySymbolFormatterDataContext, - prepareDisplaySymbolFormatter, -} from './formatters/prepareDisplaySymbolFormatter'; import { prepareTimeFormatter } from './formatters/prepareTimeFormatter'; import { Formatter } from './makeFormatter'; import { FormatterConfig, FormatterProviderConfig } from './types'; diff --git a/suite-common/formatters/src/formatters/NetworkNameFormatter.ts b/suite-common/formatters/src/formatters/NetworkNameFormatter.ts index c12e6bb8b39..7825e2d96ee 100644 --- a/suite-common/formatters/src/formatters/NetworkNameFormatter.ts +++ b/suite-common/formatters/src/formatters/NetworkNameFormatter.ts @@ -1,4 +1,4 @@ -import { getNetwork, NetworkSymbol } from '@suite-common/wallet-config'; +import { NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; import { makeFormatter } from '../makeFormatter'; diff --git a/suite-common/formatters/src/formatters/prepareCryptoAmountFormatter.ts b/suite-common/formatters/src/formatters/prepareCryptoAmountFormatter.ts index 1ff842d7e67..cf16b5b97aa 100644 --- a/suite-common/formatters/src/formatters/prepareCryptoAmountFormatter.ts +++ b/suite-common/formatters/src/formatters/prepareCryptoAmountFormatter.ts @@ -1,9 +1,9 @@ import { A } from '@mobily/ts-belt'; import { + NetworkSymbol, getNetworkOptional, isNetworkSymbol, - NetworkSymbol, networks, } from '@suite-common/wallet-config'; import { diff --git a/suite-common/formatters/src/formatters/prepareDisplaySymbolFormatter.ts b/suite-common/formatters/src/formatters/prepareDisplaySymbolFormatter.ts index 87c52bf894e..9c57ec23d87 100644 --- a/suite-common/formatters/src/formatters/prepareDisplaySymbolFormatter.ts +++ b/suite-common/formatters/src/formatters/prepareDisplaySymbolFormatter.ts @@ -1,8 +1,8 @@ import { UNIT_ABBREVIATIONS } from '@suite-common/suite-constants'; -import { getNetwork, getNetworkDisplaySymbol, NetworkSymbol } from '@suite-common/wallet-config'; +import { NetworkSymbol, getNetwork, getNetworkDisplaySymbol } from '@suite-common/wallet-config'; -import { FormatterConfig } from '../types'; import { makeFormatter } from '../makeFormatter'; +import { FormatterConfig } from '../types'; export type DisplaySymbolFormatterDataContext = { areAmountUnitsEnabled?: boolean }; diff --git a/suite-common/formatters/src/formatters/prepareFiatAmountFormatter.ts b/suite-common/formatters/src/formatters/prepareFiatAmountFormatter.ts index c0d15d970ce..d04ab86e735 100644 --- a/suite-common/formatters/src/formatters/prepareFiatAmountFormatter.ts +++ b/suite-common/formatters/src/formatters/prepareFiatAmountFormatter.ts @@ -1,7 +1,7 @@ import { FormatNumberOptions } from '@formatjs/intl'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { redactNumericalSubstring } from '@suite-common/wallet-utils'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { makeFormatter } from '../makeFormatter'; import { FormatterConfig } from '../types'; diff --git a/suite-common/formatters/src/formatters/tests/prepareDisplaySymbolFormatter.test.ts b/suite-common/formatters/src/formatters/tests/prepareDisplaySymbolFormatter.test.ts index cada120a5ca..00b59c5c07e 100644 --- a/suite-common/formatters/src/formatters/tests/prepareDisplaySymbolFormatter.test.ts +++ b/suite-common/formatters/src/formatters/tests/prepareDisplaySymbolFormatter.test.ts @@ -1,5 +1,5 @@ -import { PROTO } from '@trezor/connect'; import { NetworkSymbol } from '@suite-common/wallet-config'; +import { PROTO } from '@trezor/connect'; import { prepareDisplaySymbolFormatter } from '../prepareDisplaySymbolFormatter'; diff --git a/suite-common/formatters/src/types.ts b/suite-common/formatters/src/types.ts index c555d98cd47..9403f88150d 100644 --- a/suite-common/formatters/src/types.ts +++ b/suite-common/formatters/src/types.ts @@ -1,7 +1,7 @@ import { IntlShape } from 'react-intl'; -import { PROTO } from '@trezor/connect'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { PROTO } from '@trezor/connect'; export type FormatterProviderConfig = { locale: string; diff --git a/suite-common/formatters/src/utils/convert.ts b/suite-common/formatters/src/utils/convert.ts index 0c3b3a37245..9b1478586bd 100644 --- a/suite-common/formatters/src/utils/convert.ts +++ b/suite-common/formatters/src/utils/convert.ts @@ -1,4 +1,4 @@ -import { getNetwork, type NetworkSymbol } from '@suite-common/wallet-config'; +import { type NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; import { amountToSmallestUnit, formatNetworkAmount, diff --git a/suite-common/graph/src/graphBalanceEvents.ts b/suite-common/graph/src/graphBalanceEvents.ts index ec6ab135aa3..bcbe150702e 100644 --- a/suite-common/graph/src/graphBalanceEvents.ts +++ b/suite-common/graph/src/graphBalanceEvents.ts @@ -10,7 +10,7 @@ import { AccountBalanceHistory as AccountMovementHistory } from '@trezor/blockch import TrezorConnect from '@trezor/connect'; import { getAccountHistoryMovementFromTransactions } from './balanceHistoryUtils'; -import { isLocalBalanceHistoryCoin, isIgnoredBalanceHistoryCoin } from './constants'; +import { isIgnoredBalanceHistoryCoin, isLocalBalanceHistoryCoin } from './constants'; import { AccountHistoryMovementItem, AccountItem, diff --git a/suite-common/graph/src/graphDataFetching.ts b/suite-common/graph/src/graphDataFetching.ts index 421a8e1eb71..1c7718fea05 100644 --- a/suite-common/graph/src/graphDataFetching.ts +++ b/suite-common/graph/src/graphDataFetching.ts @@ -6,17 +6,18 @@ import { fromUnixTime, getUnixTime } from 'date-fns'; import { getFiatRatesForTimestamps } from '@suite-common/fiat-services'; import { FiatCurrencyCode } from '@suite-common/suite-config'; import { NetworkSymbol, getNetworkType } from '@suite-common/wallet-config'; +import { fetchTransactionsFromNowUntilTimestamp } from '@suite-common/wallet-core'; +import { Timestamp, TokenAddress } from '@suite-common/wallet-types'; import { formatNetworkAmount } from '@suite-common/wallet-utils'; import { AccountBalanceHistory as AccountMovementHistory } from '@trezor/blockchain-link'; import TrezorConnect, { AccountInfo } from '@trezor/connect'; import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { fetchTransactionsFromNowUntilTimestamp } from '@suite-common/wallet-core'; -import { Timestamp, TokenAddress } from '@suite-common/wallet-types'; +import { getAccountHistoryMovementFromTransactions } from './balanceHistoryUtils'; import { NUMBER_OF_POINTS, - isLocalBalanceHistoryCoin, isIgnoredBalanceHistoryCoin, + isLocalBalanceHistoryCoin, } from './constants'; import { findOldestBalanceMovementTimestamp, @@ -33,7 +34,6 @@ import { FiatGraphPoint, FiatGraphPointWithCryptoBalance, } from './types'; -import { getAccountHistoryMovementFromTransactions } from './balanceHistoryUtils'; export const addBalanceForAccountMovementHistory = ( data: AccountMovementHistory[] | AccountHistoryMovementItem[], diff --git a/suite-common/graph/src/graphUtils.ts b/suite-common/graph/src/graphUtils.ts index e866e181f17..b57aebb7a3c 100644 --- a/suite-common/graph/src/graphUtils.ts +++ b/suite-common/graph/src/graphUtils.ts @@ -1,8 +1,8 @@ import { A, D, pipe } from '@mobily/ts-belt'; import { differenceInMinutes, eachMinuteOfInterval, fromUnixTime, getUnixTime } from 'date-fns'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { AccountHistoryBalancePoint, diff --git a/suite-common/graph/src/hooks.ts b/suite-common/graph/src/hooks.ts index a34f5ac58ed..419bdecea67 100644 --- a/suite-common/graph/src/hooks.ts +++ b/suite-common/graph/src/hooks.ts @@ -1,12 +1,13 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { roundToNearestMinutes, subHours } from 'date-fns'; import { A } from '@mobily/ts-belt'; +import { roundToNearestMinutes, subHours } from 'date-fns'; import { FiatCurrencyCode } from '@suite-common/suite-config'; -import { selectIsDeviceDiscoveryActive, selectIsDeviceAuthorized } from '@suite-common/wallet-core'; +import { selectIsDeviceAuthorized, selectIsDeviceDiscoveryActive } from '@suite-common/wallet-core'; +import { getAccountMovementEvents } from './graphBalanceEvents'; import { getMultipleAccountBalanceHistoryWithFiat } from './graphDataFetching'; import { AccountItem, @@ -14,7 +15,6 @@ import { FiatGraphPointWithCryptoBalance, GroupedBalanceMovementEvent, } from './types'; -import { getAccountMovementEvents } from './graphBalanceEvents'; export type CommonUseGraphParams = { fiatCurrency: FiatCurrencyCode; diff --git a/suite-common/graph/src/tests/__fixtures__/btc.ts b/suite-common/graph/src/tests/__fixtures__/btc.ts index 50ff258aa8f..5a410a0b929 100644 --- a/suite-common/graph/src/tests/__fixtures__/btc.ts +++ b/suite-common/graph/src/tests/__fixtures__/btc.ts @@ -1,5 +1,5 @@ -import { BigNumber } from '@trezor/utils'; import { WalletAccountTransaction } from '@suite-common/wallet-types'; +import { BigNumber } from '@trezor/utils'; import { AccountHistoryMovementItem } from '../../types'; diff --git a/suite-common/graph/src/tests/__fixtures__/xrp.ts b/suite-common/graph/src/tests/__fixtures__/xrp.ts index 9d60d82cf3c..1a6e906e335 100644 --- a/suite-common/graph/src/tests/__fixtures__/xrp.ts +++ b/suite-common/graph/src/tests/__fixtures__/xrp.ts @@ -1,5 +1,5 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { WalletAccountTransaction } from '@suite-common/wallet-types'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { AccountHistoryMovementItem } from '../../types'; diff --git a/suite-common/graph/src/tests/balanceHistoryUtils.test.ts b/suite-common/graph/src/tests/balanceHistoryUtils.test.ts index 8db6e0f7019..0657cfb0209 100644 --- a/suite-common/graph/src/tests/balanceHistoryUtils.test.ts +++ b/suite-common/graph/src/tests/balanceHistoryUtils.test.ts @@ -1,13 +1,13 @@ import { TokenAddress } from '@suite-common/wallet-types'; +import { getAccountHistoryMovementFromTransactions } from '../balanceHistoryUtils'; import { btcAccountBalanceHistoryResult, btcAccountTransactions } from './__fixtures__/btc'; -import { xrpAccountTransactions, xrpBalanceHistoryResult } from './__fixtures__/xrp'; import { ethAccountBalanceHistoryResult, - ethTokenBalanceHistoryResult, ethAccountTransactions, + ethTokenBalanceHistoryResult, } from './__fixtures__/eth'; -import { getAccountHistoryMovementFromTransactions } from '../balanceHistoryUtils'; +import { xrpAccountTransactions, xrpBalanceHistoryResult } from './__fixtures__/xrp'; describe('Account balance movement history', () => { it('should getAccoutBalanceHistory for bitcoin', async () => { diff --git a/suite-common/icons-deprecated/scripts/downloadCryptoIcons.ts b/suite-common/icons-deprecated/scripts/downloadCryptoIcons.ts index 52611b8286e..3ef6f056e9e 100644 --- a/suite-common/icons-deprecated/scripts/downloadCryptoIcons.ts +++ b/suite-common/icons-deprecated/scripts/downloadCryptoIcons.ts @@ -1,14 +1,14 @@ /* eslint-disable no-console */ -import sharp from 'sharp'; import fs from 'fs'; import { join } from 'path'; +import sharp from 'sharp'; import { COIN_IMAGE_SIZES, - UPDATED_ICONS_LIST_FILE, FILES_CRYPTOICONS_PATH, RATE_LIMIT_PER_MINUTE, RUN_LIMIT_SECONDS, + UPDATED_ICONS_LIST_FILE, } from './constants'; import { CoinListData } from './types'; import { getCoinData, getCoinList, getUpdatedIconsList } from './utils/fetchCoins'; diff --git a/suite-common/icons/generateIconFont.ts b/suite-common/icons/generateIconFont.ts index 4e31d43b31f..da79eab2b9d 100644 --- a/suite-common/icons/generateIconFont.ts +++ b/suite-common/icons/generateIconFont.ts @@ -1,14 +1,13 @@ /* eslint-disable no-console */ -// disable eslint import for this file because this whole file is using only devDependencies // eslint-disable-next-line import/no-extraneous-dependencies -import { generateFonts, FontAssetType, OtherAssetType } from 'fantasticon'; +import chalk from 'chalk'; +// eslint-disable-next-line import/no-extraneous-dependencies +import { FontAssetType, OtherAssetType, generateFonts } from 'fantasticon'; import fs, { constants } from 'fs'; import path from 'path'; -// eslint-disable-next-line import/no-extraneous-dependencies -import chalk from 'chalk'; -import { type IconName as AllAvailableIcons } from './src/icons'; import { MOBILE_ICON_FONT_NAME } from './src/constants'; +import { type IconName as AllAvailableIcons } from './src/icons'; const usedIcons = [ 'arrowDown', diff --git a/suite-common/invity/src/invityAPI.ts b/suite-common/invity/src/invityAPI.ts index 33256c4c93a..3e6e3f60a8d 100644 --- a/suite-common/invity/src/invityAPI.ts +++ b/suite-common/invity/src/invityAPI.ts @@ -1,34 +1,34 @@ import { createHash } from 'crypto'; import type { - ExchangeListResponse, - ExchangeTradeQuoteResponse, - ExchangeTradeQuoteRequest, - ConfirmExchangeTradeRequest, - ExchangeTrade, BuyListResponse, + BuyTrade, + BuyTradeFormResponse, BuyTradeQuoteRequest, BuyTradeQuoteResponse, BuyTradeRequest, BuyTradeResponse, - BuyTradeFormResponse, - BuyTrade, + ConfirmExchangeTradeRequest, CountryInfo, - SellListResponse, - SellVoucherTradeQuoteRequest, - SellVoucherTradeRequest, - SellFiatTradeQuoteRequest, + ExchangeListResponse, + ExchangeTrade, + ExchangeTradeQuoteRequest, + ExchangeTradeQuoteResponse, + InfoResponse, SellFiatTrade, + SellFiatTradeQuoteRequest, SellFiatTradeQuoteResponse, SellFiatTradeRequest, SellFiatTradeResponse, - InfoResponse, + SellListResponse, + SellVoucherTradeQuoteRequest, + SellVoucherTradeRequest, } from 'invity-api'; import type { InvityServerEnvironment, InvityServers, - TradingTradeType, TradingPaymentMethodType, + TradingTradeType, TradingType, TradingWatchTradeResponsePropsMap, } from '@suite-common/invity'; diff --git a/suite-common/message-system/scripts/sign-config.ts b/suite-common/message-system/scripts/sign-config.ts index f162ad35468..4963297f058 100644 --- a/suite-common/message-system/scripts/sign-config.ts +++ b/suite-common/message-system/scripts/sign-config.ts @@ -6,8 +6,8 @@ import { join } from 'path'; import { CONFIG_PATH, PACKAGE_ROOT } from './constants'; import { - JWS_CONFIG_FILENAME_REMOTE, JWS_CONFIG_FILENAME_LOCAL, + JWS_CONFIG_FILENAME_REMOTE, JWS_SIGN_ALGORITHM, } from '../src/messageSystemConstants'; diff --git a/suite-common/message-system/scripts/validate-config.ts b/suite-common/message-system/scripts/validate-config.ts index e18eacfc423..8b939693a21 100644 --- a/suite-common/message-system/scripts/validate-config.ts +++ b/suite-common/message-system/scripts/validate-config.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import * as fs from 'fs'; import Ajv from 'ajv'; +import * as fs from 'fs'; import { CONFIG_PATH, SCHEMA_PATH } from './constants'; diff --git a/suite-common/message-system/src/__fixtures__/messageSystemUtils.ts b/suite-common/message-system/src/__fixtures__/messageSystemUtils.ts index 82b132a832c..128f1e913fd 100644 --- a/suite-common/message-system/src/__fixtures__/messageSystemUtils.ts +++ b/suite-common/message-system/src/__fixtures__/messageSystemUtils.ts @@ -1,5 +1,5 @@ -import { DeviceModelInternal, FirmwareType } from '@trezor/connect'; import { testMocks } from '@suite-common/test-utils'; +import { DeviceModelInternal, FirmwareType } from '@trezor/connect'; const { getDeviceFeatures, getConnectDevice, getMessageSystemConfig } = testMocks; diff --git a/suite-common/message-system/src/__tests__/experimentUtils.test.ts b/suite-common/message-system/src/__tests__/experimentUtils.test.ts index e2e0bc11c77..c37a0a1dd15 100644 --- a/suite-common/message-system/src/__tests__/experimentUtils.test.ts +++ b/suite-common/message-system/src/__tests__/experimentUtils.test.ts @@ -1,9 +1,9 @@ +import { experimentTest, getArrayOfInstanceIds } from '../__fixtures__/experimentUtils'; import { getExperimentGroupByInclusion, getInclusionFromInstanceId, selectActiveExperimentGroup, } from '../experimentUtils'; -import { experimentTest, getArrayOfInstanceIds } from '../__fixtures__/experimentUtils'; import { ExperimentId } from '../messageSystemTypes'; describe('testing experiment utils', () => { diff --git a/suite-common/message-system/src/__tests__/messageSystemActions.test.ts b/suite-common/message-system/src/__tests__/messageSystemActions.test.ts index 414f59ae2a6..fb033b46b2f 100644 --- a/suite-common/message-system/src/__tests__/messageSystemActions.test.ts +++ b/suite-common/message-system/src/__tests__/messageSystemActions.test.ts @@ -2,13 +2,13 @@ import { combineReducers } from '@reduxjs/toolkit'; import { configureMockStore, extraDependenciesMock } from '@suite-common/test-utils'; +import * as fixtures from '../__fixtures__/messageSystemActions'; import { - prepareMessageSystemReducer, - messageSystemActions, - initMessageSystemThunk, MessageSystemState, + initMessageSystemThunk, + messageSystemActions, + prepareMessageSystemReducer, } from '../index'; -import * as fixtures from '../__fixtures__/messageSystemActions'; const messageSystemReducer = prepareMessageSystemReducer(extraDependenciesMock); diff --git a/suite-common/message-system/src/__tests__/messageSystemReducer.test.ts b/suite-common/message-system/src/__tests__/messageSystemReducer.test.ts index aa38810fcdb..74c3e43d721 100644 --- a/suite-common/message-system/src/__tests__/messageSystemReducer.test.ts +++ b/suite-common/message-system/src/__tests__/messageSystemReducer.test.ts @@ -1,9 +1,9 @@ -import { combineReducers, AnyAction } from '@reduxjs/toolkit'; +import { AnyAction, combineReducers } from '@reduxjs/toolkit'; import { configureMockStore, extraDependenciesMock } from '@suite-common/test-utils'; -import { prepareMessageSystemReducer } from '../messageSystemReducer'; import { fixtures, timestamp } from '../__fixtures__/messageSystemReducer'; +import { prepareMessageSystemReducer } from '../messageSystemReducer'; const messageSystemReducer = prepareMessageSystemReducer(extraDependenciesMock); diff --git a/suite-common/message-system/src/__tests__/messageSystemUtils.test.ts b/suite-common/message-system/src/__tests__/messageSystemUtils.test.ts index 426b70fe2ff..842cee862a2 100644 --- a/suite-common/message-system/src/__tests__/messageSystemUtils.test.ts +++ b/suite-common/message-system/src/__tests__/messageSystemUtils.test.ts @@ -1,7 +1,7 @@ import * as envUtils from '@trezor/env-utils'; -import * as messageSystem from '../messageSystemUtils'; import * as fixtures from '../__fixtures__/messageSystemUtils'; +import * as messageSystem from '../messageSystemUtils'; describe('Message system utils', () => { describe('createVersionRange', () => { diff --git a/suite-common/message-system/src/messageSystemSelectors.ts b/suite-common/message-system/src/messageSystemSelectors.ts index ca9f8f9d679..f1463fcdde9 100644 --- a/suite-common/message-system/src/messageSystemSelectors.ts +++ b/suite-common/message-system/src/messageSystemSelectors.ts @@ -1,6 +1,6 @@ -import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; -import { Message, Category } from '@suite-common/suite-types'; import { ExperimentId } from '@suite-common/message-system'; +import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils'; +import { Category, Message } from '@suite-common/suite-types'; import { ContextDomain, diff --git a/suite-common/message-system/src/messageSystemThunks.ts b/suite-common/message-system/src/messageSystemThunks.ts index 8fde2b5a4e4..d34d419638b 100644 --- a/suite-common/message-system/src/messageSystemThunks.ts +++ b/suite-common/message-system/src/messageSystemThunks.ts @@ -1,24 +1,24 @@ import { decode, verify } from 'jws'; -import { getJWSPublicKey, isCodesignBuild, isNative } from '@trezor/env-utils'; -import { scheduleAction } from '@trezor/utils'; import { createThunk } from '@suite-common/redux-utils'; import { MessageSystem } from '@suite-common/suite-types'; +import { getJWSPublicKey, isCodesignBuild, isNative } from '@trezor/env-utils'; +import { scheduleAction } from '@trezor/utils'; +import { ACTION_PREFIX, messageSystemActions } from './messageSystemActions'; import { - VERSION, - JWS_SIGN_ALGORITHM, CONFIG_URL_REMOTE, + FETCH_CHECK_INTERVAL_IN_MS, + FETCH_CHECK_INTERVAL_IN_MS_MOBILE, FETCH_INTERVAL_IN_MS, FETCH_INTERVAL_IN_MS_MOBILE, FETCH_TIMEOUT_IN_MS, - FETCH_CHECK_INTERVAL_IN_MS, - FETCH_CHECK_INTERVAL_IN_MS_MOBILE, + JWS_SIGN_ALGORITHM, + VERSION, } from './messageSystemConstants'; -import { ACTION_PREFIX, messageSystemActions } from './messageSystemActions'; import { - selectMessageSystemTimestamp, selectMessageSystemCurrentSequence, + selectMessageSystemTimestamp, } from './messageSystemSelectors'; import { jws as configJwsLocal } from '../files/config.v1'; diff --git a/suite-common/message-system/src/messageSystemTypes.ts b/suite-common/message-system/src/messageSystemTypes.ts index 6e0cb158d3f..227503000c8 100644 --- a/suite-common/message-system/src/messageSystemTypes.ts +++ b/suite-common/message-system/src/messageSystemTypes.ts @@ -1,4 +1,4 @@ -import { ExperimentsItem, MessageSystem, Category } from '@suite-common/suite-types'; +import { Category, ExperimentsItem, MessageSystem } from '@suite-common/suite-types'; export type MessageState = { [key in Category]: boolean }; diff --git a/suite-common/message-system/src/messageSystemUtils.ts b/suite-common/message-system/src/messageSystemUtils.ts index 891d464a4a3..3bfbe8f064c 100644 --- a/suite-common/message-system/src/messageSystemUtils.ts +++ b/suite-common/message-system/src/messageSystemUtils.ts @@ -1,26 +1,16 @@ import * as semver from 'semver'; -import { - getEnvironment, - getBrowserName, - getBrowserVersion, - getCommitHash, - getOsName, - getOsVersion, - getSuiteVersion, - Environment as EnvironmentType, -} from '@trezor/env-utils'; import type { - TrezorDevice, + Condition, + Device, Duration, - MessageSystem, + Environment, Message, - Version, + MessageSystem, Settings, Transport, - Device, - Environment, - Condition, + TrezorDevice, + Version, } from '@suite-common/suite-types'; import type { NetworkSymbol } from '@suite-common/wallet-config'; import type { TransportInfo } from '@trezor/connect'; @@ -29,6 +19,16 @@ import { getFirmwareRevision, getFirmwareVersion, } from '@trezor/device-utils'; +import { + Environment as EnvironmentType, + getBrowserName, + getBrowserVersion, + getCommitHash, + getEnvironment, + getOsName, + getOsVersion, + getSuiteVersion, +} from '@trezor/env-utils'; import { ValidMessagesPayload } from './messageSystemActions'; diff --git a/suite-common/redux-utils/src/createActionWithExtraDeps.ts b/suite-common/redux-utils/src/createActionWithExtraDeps.ts index 0604846a576..d8e8d3863e3 100644 --- a/suite-common/redux-utils/src/createActionWithExtraDeps.ts +++ b/suite-common/redux-utils/src/createActionWithExtraDeps.ts @@ -1,4 +1,4 @@ -import { ActionCreatorWithPreparedPayload, createAction, Dispatch } from '@reduxjs/toolkit'; +import { ActionCreatorWithPreparedPayload, Dispatch, createAction } from '@reduxjs/toolkit'; import { ExtraDependencies } from './extraDependenciesType'; diff --git a/suite-common/redux-utils/src/createMiddleware.ts b/suite-common/redux-utils/src/createMiddleware.ts index ba0a9bbba02..501d95dec45 100644 --- a/suite-common/redux-utils/src/createMiddleware.ts +++ b/suite-common/redux-utils/src/createMiddleware.ts @@ -1,5 +1,5 @@ -import { Action, AnyAction, Dispatch, Middleware, MiddlewareAPI } from 'redux'; import { ThunkDispatch } from '@reduxjs/toolkit'; +import { Action, AnyAction, Dispatch, Middleware, MiddlewareAPI } from 'redux'; import { ExtraDependencies } from './extraDependenciesType'; diff --git a/suite-common/redux-utils/src/createSingleInstanceThunk.ts b/suite-common/redux-utils/src/createSingleInstanceThunk.ts index f66be318449..a347343188c 100644 --- a/suite-common/redux-utils/src/createSingleInstanceThunk.ts +++ b/suite-common/redux-utils/src/createSingleInstanceThunk.ts @@ -1,7 +1,7 @@ import { - createAsyncThunk as createAsyncThunkReduxToolkit, AsyncThunkOptions, AsyncThunkPayloadCreator, + createAsyncThunk as createAsyncThunkReduxToolkit, } from '@reduxjs/toolkit'; import { CustomThunkAPI } from './extraDependenciesType'; // Adjust the import path according to your project structure diff --git a/suite-common/redux-utils/src/createSliceWithExtraDeps.ts b/suite-common/redux-utils/src/createSliceWithExtraDeps.ts index 04c10bf3c73..803527a12b2 100644 --- a/suite-common/redux-utils/src/createSliceWithExtraDeps.ts +++ b/suite-common/redux-utils/src/createSliceWithExtraDeps.ts @@ -1,9 +1,9 @@ import { ActionReducerMapBuilder, - createAction, - createSlice, CreateSliceOptions, SliceCaseReducers, + createAction, + createSlice, } from '@reduxjs/toolkit'; import { ExtraDependenciesForReducer } from './extraDependenciesType'; diff --git a/suite-common/redux-utils/src/extraDependenciesType.ts b/suite-common/redux-utils/src/extraDependenciesType.ts index de596477c12..60120c5c137 100644 --- a/suite-common/redux-utils/src/extraDependenciesType.ts +++ b/suite-common/redux-utils/src/extraDependenciesType.ts @@ -1,9 +1,13 @@ import { - ActionCreatorWithoutPayload, ActionCreatorWithPayload, ActionCreatorWithPreparedPayload, + ActionCreatorWithoutPayload, } from '@reduxjs/toolkit'; +import { MetadataAddPayload } from '@suite-common/metadata-types'; +import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { AcquiredDevice, Route, TrezorDevice, UserContextPayload } from '@suite-common/suite-types'; +import { NetworkSymbol } from '@suite-common/wallet-config'; import { Account, AccountKey, @@ -13,8 +17,6 @@ import { WalletAccountTransaction, WalletType, } from '@suite-common/wallet-types'; -import { NetworkSymbol } from '@suite-common/wallet-config'; -import { AcquiredDevice, Route, TrezorDevice, UserContextPayload } from '@suite-common/suite-types'; import { BlockchainBlock, ConnectSettings, @@ -22,8 +24,6 @@ import { PROTO, StaticSessionId, } from '@trezor/connect'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; -import { MetadataAddPayload } from '@suite-common/metadata-types'; import { ActionType, SuiteCompatibleSelector, SuiteCompatibleThunk } from './types'; diff --git a/suite-common/sentry/src/index.ts b/suite-common/sentry/src/index.ts index d6f226b7a91..10d6b385c43 100644 --- a/suite-common/sentry/src/index.ts +++ b/suite-common/sentry/src/index.ts @@ -1,4 +1,4 @@ -import { captureConsoleIntegration, Options, Event as SentryEvent } from '@sentry/core'; +import { Options, Event as SentryEvent, captureConsoleIntegration } from '@sentry/core'; import { isDevEnv } from '@suite-common/suite-utils'; import { redactUserPathFromString } from '@trezor/utils'; diff --git a/suite-common/suite-types/src/device.ts b/suite-common/suite-types/src/device.ts index 74c2128e520..64b08139e8d 100644 --- a/suite-common/suite-types/src/device.ts +++ b/suite-common/suite-types/src/device.ts @@ -1,3 +1,4 @@ +import { DeviceMetadata } from '@suite-common/metadata-types'; import { DeviceButtonRequest, DeviceEvent, @@ -7,7 +8,6 @@ import { UnknownDevice as UnknownDeviceBase, UnreadableDevice as UnreadableDeviceBase, } from '@trezor/connect'; -import { DeviceMetadata } from '@suite-common/metadata-types'; // Extend original ButtonRequestMessage from @trezor/connect // suite (deviceReducer) stores them in slightly different shape: diff --git a/suite-common/suite-types/src/index.ts b/suite-common/suite-types/src/index.ts index 6ab0d95b512..aefbb595e99 100644 --- a/suite-common/suite-types/src/index.ts +++ b/suite-common/suite-types/src/index.ts @@ -1,4 +1,4 @@ -import { ActionCreatorWithoutPayload, ActionCreatorWithPayload, AnyAction } from '@reduxjs/toolkit'; +import { ActionCreatorWithPayload, ActionCreatorWithoutPayload, AnyAction } from '@reduxjs/toolkit'; export * from './device'; export * from './guide'; diff --git a/suite-common/suite-types/src/modal.ts b/suite-common/suite-types/src/modal.ts index 104856cc4c9..a54824dc324 100644 --- a/suite-common/suite-types/src/modal.ts +++ b/suite-common/suite-types/src/modal.ts @@ -1,7 +1,7 @@ -import { Deferred } from '@trezor/utils'; -import { Account, AddressType, WalletAccountTransaction } from '@suite-common/wallet-types'; import { RequestEnableTorResponse } from '@suite-common/suite-config'; import { type NetworkSymbol } from '@suite-common/wallet-config'; +import { Account, AddressType, WalletAccountTransaction } from '@suite-common/wallet-types'; +import { Deferred } from '@trezor/utils'; import { TrezorDevice } from './device'; diff --git a/suite-common/suite-types/src/route.ts b/suite-common/suite-types/src/route.ts index 47f584fda52..ae22a3e322d 100644 --- a/suite-common/suite-types/src/route.ts +++ b/suite-common/suite-types/src/route.ts @@ -1,5 +1,5 @@ -import { ArrayElement, ConstWithOptionalFields } from '@trezor/type-utils'; import { routes } from '@suite-common/suite-config'; +import { ArrayElement, ConstWithOptionalFields } from '@trezor/type-utils'; type RouteKeys = | keyof ArrayElement diff --git a/suite-common/suite-utils/src/__tests__/parseFirmwareChangelog.test.ts b/suite-common/suite-utils/src/__tests__/parseFirmwareChangelog.test.ts index 327aeab7e88..99b1edae060 100644 --- a/suite-common/suite-utils/src/__tests__/parseFirmwareChangelog.test.ts +++ b/suite-common/suite-utils/src/__tests__/parseFirmwareChangelog.test.ts @@ -1,9 +1,9 @@ import { FirmwareRelease } from '@trezor/connect'; import { - parseFirmwareChangelog, ParseFirmwareChangelogParams, ParseFirmwareChangelogResult, + parseFirmwareChangelog, } from '../parseFirmwareChangelog'; const CHANGELOG_STRING = diff --git a/suite-common/suite-utils/src/__tests__/protocol.test.ts b/suite-common/suite-utils/src/__tests__/protocol.test.ts index d61044895c4..fe81520df14 100644 --- a/suite-common/suite-utils/src/__tests__/protocol.test.ts +++ b/suite-common/suite-utils/src/__tests__/protocol.test.ts @@ -1,7 +1,7 @@ import { Protocol } from '@suite-common/suite-constants'; -import { getNetworkSymbolForProtocol } from '../protocol'; import * as fixtures from '../__fixtures__/protocol'; +import { getNetworkSymbolForProtocol } from '../protocol'; describe('getNetworkSymbolForProtocol', () => { fixtures.getNetworkSymbolForProtocol.forEach(f => { diff --git a/suite-common/suite-utils/src/date.ts b/suite-common/suite-utils/src/date.ts index df13908d853..9e865aaf2ac 100644 --- a/suite-common/suite-utils/src/date.ts +++ b/suite-common/suite-utils/src/date.ts @@ -1,17 +1,17 @@ import { + Locale, + differenceInCalendarMonths, + differenceInMinutes, + differenceInMonths, + eachDayOfInterval, + eachMonthOfInterval, + eachQuarterOfInterval, formatDistance, formatDistanceStrict, - differenceInMonths, fromUnixTime, getUnixTime, startOfDay, startOfMonth, - differenceInCalendarMonths, - eachQuarterOfInterval, - eachMonthOfInterval, - eachDayOfInterval, - differenceInMinutes, - Locale, } from 'date-fns'; export const formatDuration = (seconds: number) => diff --git a/suite-common/suite-utils/src/device.ts b/suite-common/suite-utils/src/device.ts index 9e29f076b24..5bc2da82bfb 100644 --- a/suite-common/suite-utils/src/device.ts +++ b/suite-common/suite-utils/src/device.ts @@ -1,5 +1,5 @@ -import { Device, UnavailableCapability, DeviceModelInternal, KnownDevice } from '@trezor/connect'; -import { TrezorDevice, AcquiredDevice } from '@suite-common/suite-types'; +import { AcquiredDevice, TrezorDevice } from '@suite-common/suite-types'; +import { Device, DeviceModelInternal, KnownDevice, UnavailableCapability } from '@trezor/connect'; import * as URLS from '@trezor/urls'; /** diff --git a/suite-common/suite-utils/src/features.ts b/suite-common/suite-utils/src/features.ts index 8583612b50c..ff646e82915 100644 --- a/suite-common/suite-utils/src/features.ts +++ b/suite-common/suite-utils/src/features.ts @@ -1,4 +1,4 @@ -import { FLAGS, FLAGS_WEB, FLAGS_DESKTOP, FeatureFlags } from '@suite-common/suite-config'; +import { FLAGS, FLAGS_DESKTOP, FLAGS_WEB, FeatureFlags } from '@suite-common/suite-config'; const getFlagsForEnv = (env?: string) => { switch (env) { diff --git a/suite-common/suite-utils/src/protocol.ts b/suite-common/suite-utils/src/protocol.ts index f2399cd19c7..8cea95e2bdc 100644 --- a/suite-common/suite-utils/src/protocol.ts +++ b/suite-common/suite-utils/src/protocol.ts @@ -1,5 +1,5 @@ -import { Protocol, NETWORK_TO_PROTOCOLS } from '@suite-common/suite-constants'; -import { isNetworkSymbol, NetworkSymbol } from '@suite-common/wallet-config'; +import { NETWORK_TO_PROTOCOLS, Protocol } from '@suite-common/suite-constants'; +import { NetworkSymbol, isNetworkSymbol } from '@suite-common/wallet-config'; export type ProtocolToNetwork = { [P in Protocol]: NetworkSymbol; diff --git a/suite-common/test-utils/src/configureMockStore.ts b/suite-common/test-utils/src/configureMockStore.ts index 5d8cdf43658..bf56a80c34e 100644 --- a/suite-common/test-utils/src/configureMockStore.ts +++ b/suite-common/test-utils/src/configureMockStore.ts @@ -1,3 +1,4 @@ +import { D } from '@mobily/ts-belt'; import { configureStore } from '@reduxjs/toolkit'; import { Action, @@ -8,10 +9,9 @@ import { Reducer, ReducersMapObject, } from 'redux'; -import { D } from '@mobily/ts-belt'; import { ThunkDispatch } from 'redux-thunk'; -import { createMiddleware, ExtraDependenciesPartial } from '@suite-common/redux-utils'; +import { ExtraDependenciesPartial, createMiddleware } from '@suite-common/redux-utils'; import { mergeDeepObject } from '@trezor/utils'; import { extraDependenciesMock } from './extraDependenciesMock'; diff --git a/suite-common/test-utils/src/extraDependenciesMock.ts b/suite-common/test-utils/src/extraDependenciesMock.ts index d5e5c65750b..4500b519174 100644 --- a/suite-common/test-utils/src/extraDependenciesMock.ts +++ b/suite-common/test-utils/src/extraDependenciesMock.ts @@ -1,10 +1,10 @@ import { createAction } from '@reduxjs/toolkit'; +import { ExtraDependencies, createThunk } from '@suite-common/redux-utils'; import { BITCOIN_ONLY_SYMBOLS } from '@suite-common/suite-constants'; -import { createThunk, ExtraDependencies } from '@suite-common/redux-utils'; -import { PROTO } from '@trezor/connect'; -import { AddressDisplayOptions } from '@suite-common/wallet-types'; import { Route } from '@suite-common/suite-types'; +import { AddressDisplayOptions } from '@suite-common/wallet-types'; +import { PROTO } from '@trezor/connect'; import { testMocks } from './mocks'; diff --git a/suite-common/test-utils/src/mocks.ts b/suite-common/test-utils/src/mocks.ts index bdfbebf320c..31bbf584523 100644 --- a/suite-common/test-utils/src/mocks.ts +++ b/suite-common/test-utils/src/mocks.ts @@ -1,29 +1,29 @@ /* WARNING! This file should be imported ONLY in tests! */ import { - TrezorConnect, - AccountUtxo, - Device, - Features, - DeviceModelInternal, - FirmwareType, - DeviceUniquePath, -} from '@trezor/connect'; -import { - TrezorDevice, - GuideNode, + Action, GuideArticle, GuideCategory, + GuideNode, MessageSystem, - Action, + TrezorDevice, } from '@suite-common/suite-types'; +import { networksCollection } from '@suite-common/wallet-config'; import { Account, + BlockchainNetworks, FeeInfo, WalletAccountTransaction, - BlockchainNetworks, } from '@suite-common/wallet-types'; -import { networksCollection } from '@suite-common/wallet-config'; +import { + AccountUtxo, + Device, + DeviceModelInternal, + DeviceUniquePath, + Features, + FirmwareType, + TrezorConnect, +} from '@trezor/connect'; // in-memory implementation of indexedDB import 'fake-indexeddb/auto'; diff --git a/suite-common/toast-notifications/src/notificationsActions.ts b/suite-common/toast-notifications/src/notificationsActions.ts index 0a1330fd65a..2d967717ee9 100644 --- a/suite-common/toast-notifications/src/notificationsActions.ts +++ b/suite-common/toast-notifications/src/notificationsActions.ts @@ -3,7 +3,7 @@ import { createAction } from '@reduxjs/toolkit'; import { createActionWithExtraDeps } from '@suite-common/redux-utils'; import { selectVisibleNotificationsByType } from './notificationsSelectors'; -import { NotificationId, NotificationEntry, NotificationEventPayload, ToastPayload } from './types'; +import { NotificationEntry, NotificationEventPayload, NotificationId, ToastPayload } from './types'; export const ACTION_PREFIX = '@common/in-app-notifications'; diff --git a/suite-common/token-definitions/scripts/index.ts b/suite-common/token-definitions/scripts/index.ts index 2d97952985b..4a41e29c422 100644 --- a/suite-common/token-definitions/scripts/index.ts +++ b/suite-common/token-definitions/scripts/index.ts @@ -1,12 +1,12 @@ /* eslint-disable no-console */ -import { join } from 'path'; import fs from 'fs'; +import { join } from 'path'; +import { DEFINITIONS_FILENAME_SUFFIX, FILES_PATH } from './constants'; +import { fetchCoinData } from './utils/fetchCoins'; import { fetchNftData } from './utils/fetchNft'; import { signData } from './utils/sign'; import { validateStructure } from './utils/validate'; -import { FILES_PATH, DEFINITIONS_FILENAME_SUFFIX } from './constants'; -import { fetchCoinData } from './utils/fetchCoins'; import { TokenStructure } from '../src/tokenDefinitionsTypes'; const main = async () => { diff --git a/suite-common/token-definitions/scripts/utils/fetchCoins.ts b/suite-common/token-definitions/scripts/utils/fetchCoins.ts index d1103cf168a..43fc5e293ed 100644 --- a/suite-common/token-definitions/scripts/utils/fetchCoins.ts +++ b/suite-common/token-definitions/scripts/utils/fetchCoins.ts @@ -1,8 +1,8 @@ /* eslint-disable no-console */ import { blockfrostUtils } from '@trezor/blockchain-link-utils'; -import { COIN_LIST_URL } from '../constants'; import { AdvancedTokenStructure, SimpleTokenStructure } from '../../src/tokenDefinitionsTypes'; +import { COIN_LIST_URL } from '../constants'; import { CoinData } from '../types'; const getContractAddress = (assetPlatformId: string, platforms: CoinData['platforms']) => { diff --git a/suite-common/token-definitions/scripts/utils/fetchNft.ts b/suite-common/token-definitions/scripts/utils/fetchNft.ts index 43a62587053..7c2e24ff158 100644 --- a/suite-common/token-definitions/scripts/utils/fetchNft.ts +++ b/suite-common/token-definitions/scripts/utils/fetchNft.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import { NFTS_PER_PAGE, NFT_LIST_URL } from '../constants'; import { AdvancedTokenStructure, SimpleTokenStructure } from '../../src/tokenDefinitionsTypes'; +import { NFTS_PER_PAGE, NFT_LIST_URL } from '../constants'; import { NftData } from '../types'; const fetchNftPage = async (page: number, assetPlatformId: string): Promise => { diff --git a/suite-common/token-definitions/scripts/utils/validate.ts b/suite-common/token-definitions/scripts/utils/validate.ts index 40679d8c849..b4492a7815c 100644 --- a/suite-common/token-definitions/scripts/utils/validate.ts +++ b/suite-common/token-definitions/scripts/utils/validate.ts @@ -1,11 +1,11 @@ /* eslint-disable no-console */ -import * as fs from 'fs'; // eslint-disable-next-line import/no-extraneous-dependencies import Ajv from 'ajv'; +import * as fs from 'fs'; import { join } from 'path'; -import { SCHEMA_FILENAME_SUFFIX, SCHEMA_PATH } from '../constants'; import { TokenStructure } from '../../src/tokenDefinitionsTypes'; +import { SCHEMA_FILENAME_SUFFIX, SCHEMA_PATH } from '../constants'; // checks that a config meets the criteria specified by the schema export const validateStructure = (nftData: TokenStructure, structure: string) => { diff --git a/suite-common/token-definitions/src/__fixtures__/antiFraud.ts b/suite-common/token-definitions/src/__fixtures__/antiFraud.ts index fbd98f51da8..d676baa99db 100644 --- a/suite-common/token-definitions/src/__fixtures__/antiFraud.ts +++ b/suite-common/token-definitions/src/__fixtures__/antiFraud.ts @@ -1,5 +1,5 @@ -import type { TokenTransfer } from '@trezor/blockchain-link'; import type { WalletAccountTransaction } from '@suite-common/wallet-types'; +import type { TokenTransfer } from '@trezor/blockchain-link'; import type { TokenDefinitions } from '../tokenDefinitionsTypes'; export const getIsZeroValuePhishingFixtures = [ diff --git a/suite-common/token-definitions/src/__tests__/antiFraud.test.ts b/suite-common/token-definitions/src/__tests__/antiFraud.test.ts index 6bf90537707..e546ce42165 100644 --- a/suite-common/token-definitions/src/__tests__/antiFraud.test.ts +++ b/suite-common/token-definitions/src/__tests__/antiFraud.test.ts @@ -1,7 +1,7 @@ import { getIsFakeTokenPhishingFixtures, - getIsZeroValuePhishingFixtures, getIsPhishingTransactionFixtures, + getIsZeroValuePhishingFixtures, } from '../__fixtures__/antiFraud'; import { getIsFakeTokenPhishing, diff --git a/suite-common/token-definitions/src/__tests__/utils.test.ts b/suite-common/token-definitions/src/__tests__/utils.test.ts index 19f4033f81e..26796ff07d4 100644 --- a/suite-common/token-definitions/src/__tests__/utils.test.ts +++ b/suite-common/token-definitions/src/__tests__/utils.test.ts @@ -1,7 +1,7 @@ import { + buildTokenDefinitionsFromStorageFixtures, getSupportedDefinitionTypesFixtures, isTokenDefinitionKnownFixtures, - buildTokenDefinitionsFromStorageFixtures, } from '../__fixtures__/utils'; import { buildTokenDefinitionsFromStorage, diff --git a/suite-common/token-definitions/src/antiFraud.ts b/suite-common/token-definitions/src/antiFraud.ts index 9639c6ba06f..323abe95ffe 100644 --- a/suite-common/token-definitions/src/antiFraud.ts +++ b/suite-common/token-definitions/src/antiFraud.ts @@ -1,9 +1,9 @@ import { D } from '@mobily/ts-belt'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import type { WalletAccountTransaction } from '@suite-common/wallet-types'; import { getNetworkType } from '@suite-common/wallet-config'; +import type { WalletAccountTransaction } from '@suite-common/wallet-types'; import { isNftTokenTransfer } from '@suite-common/wallet-utils'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import type { TokenDefinitions } from './tokenDefinitionsTypes'; import { isTokenDefinitionKnown } from './tokenDefinitionsUtils'; diff --git a/suite-common/token-definitions/src/tokenDefinitionsReducer.ts b/suite-common/token-definitions/src/tokenDefinitionsReducer.ts index cc012d975a6..ce9559505dc 100644 --- a/suite-common/token-definitions/src/tokenDefinitionsReducer.ts +++ b/suite-common/token-definitions/src/tokenDefinitionsReducer.ts @@ -1,8 +1,8 @@ import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; +import { tokenDefinitionsActions } from './tokenDefinitionsActions'; import { getTokenDefinitionThunk } from './tokenDefinitionsThunks'; import { TokenDefinitionsState, TokenManagementAction } from './tokenDefinitionsTypes'; -import { tokenDefinitionsActions } from './tokenDefinitionsActions'; const initialStatePredefined: Partial = {}; diff --git a/suite-common/token-definitions/src/tokenDefinitionsThunks.ts b/suite-common/token-definitions/src/tokenDefinitionsThunks.ts index 8446c949766..103b1fb9583 100644 --- a/suite-common/token-definitions/src/tokenDefinitionsThunks.ts +++ b/suite-common/token-definitions/src/tokenDefinitionsThunks.ts @@ -1,17 +1,17 @@ -import { decode, verify } from 'jws'; import { D, G } from '@mobily/ts-belt'; +import { decode, verify } from 'jws'; -import { getJWSPublicKey, isCodesignBuild } from '@trezor/env-utils'; import { createThunk } from '@suite-common/redux-utils'; import { NetworkSymbol, getCoingeckoId } from '@suite-common/wallet-config'; +import { getJWSPublicKey, isCodesignBuild } from '@trezor/env-utils'; import { TimerId } from '@trezor/type-utils'; -import { selectNetworkTokenDefinitions } from './tokenDefinitionsSelectors'; import { + JWS_SIGN_ALGORITHM, TOKEN_DEFINITIONS_PREFIX_URL, TOKEN_DEFINITIONS_SUFFIX_URL, - JWS_SIGN_ALGORITHM, } from './tokenDefinitionsConstants'; +import { selectNetworkTokenDefinitions } from './tokenDefinitionsSelectors'; import { DefinitionType } from './tokenDefinitionsTypes'; import { getSupportedDefinitionTypes } from './tokenDefinitionsUtils'; diff --git a/suite-common/validators/src/schemas/xpubSchema.ts b/suite-common/validators/src/schemas/xpubSchema.ts index e40281c69a2..10e5ba65ff9 100644 --- a/suite-common/validators/src/schemas/xpubSchema.ts +++ b/suite-common/validators/src/schemas/xpubSchema.ts @@ -1,7 +1,7 @@ import { G } from '@mobily/ts-belt'; import { type NetworkSymbol, getNetworkType } from '@suite-common/wallet-config'; -import { isAddressValid, isAddressBasedNetwork } from '@suite-common/wallet-utils'; +import { isAddressBasedNetwork, isAddressValid } from '@suite-common/wallet-utils'; import { yup } from '../config'; diff --git a/suite-common/wallet-config/src/getExplorerUrls.ts b/suite-common/wallet-config/src/getExplorerUrls.ts index 4b181a1d990..d46a3afc707 100644 --- a/suite-common/wallet-config/src/getExplorerUrls.ts +++ b/suite-common/wallet-config/src/getExplorerUrls.ts @@ -1,4 +1,4 @@ -import { NetworkType, Explorer } from './types'; +import { Explorer, NetworkType } from './types'; type NetworkTypeExplorerMap = { [key in NetworkType]: Explorer; diff --git a/suite-common/wallet-config/src/networksConfig.ts b/suite-common/wallet-config/src/networksConfig.ts index 013a7bf307d..92b75313d5f 100644 --- a/suite-common/wallet-config/src/networksConfig.ts +++ b/suite-common/wallet-config/src/networksConfig.ts @@ -1,7 +1,7 @@ import { DeviceModelInternal } from '@trezor/connect'; -import { Networks } from './types'; import { getExplorerUrls } from './getExplorerUrls'; +import { Networks } from './types'; export const networks = { btc: { diff --git a/suite-common/wallet-core/src/accounts/accountsActions.ts b/suite-common/wallet-core/src/accounts/accountsActions.ts index af7fea15dab..a8b344f1ea8 100644 --- a/suite-common/wallet-core/src/accounts/accountsActions.ts +++ b/suite-common/wallet-core/src/accounts/accountsActions.ts @@ -1,7 +1,7 @@ import { createAction } from '@reduxjs/toolkit'; -import { AccountInfo, StaticSessionId } from '@trezor/connect'; -import { Account, SelectedAccountStatus, DiscoveryItem } from '@suite-common/wallet-types'; +import { getNetwork } from '@suite-common/wallet-config'; +import { Account, DiscoveryItem, SelectedAccountStatus } from '@suite-common/wallet-types'; import { enhanceAddresses, enhanceTokens, @@ -10,7 +10,7 @@ import { getAccountKey, getAccountSpecific, } from '@suite-common/wallet-utils'; -import { getNetwork } from '@suite-common/wallet-config'; +import { AccountInfo, StaticSessionId } from '@trezor/connect'; import { ACCOUNTS_MODULE_PREFIX } from './accountsConstants'; diff --git a/suite-common/wallet-core/src/accounts/accountsReducer.ts b/suite-common/wallet-core/src/accounts/accountsReducer.ts index 0a90f01c410..3592cc02443 100644 --- a/suite-common/wallet-core/src/accounts/accountsReducer.ts +++ b/suite-common/wallet-core/src/accounts/accountsReducer.ts @@ -1,25 +1,25 @@ -import { isAnyOf } from '@reduxjs/toolkit'; import { A, F, G, pipe } from '@mobily/ts-belt'; +import { isAnyOf } from '@reduxjs/toolkit'; import { createReducerWithExtraDeps, createWeakMapSelector, returnStableArrayIfEmpty, } from '@suite-common/redux-utils'; -import { enhanceHistory, isTestnet, isUtxoBased } from '@suite-common/wallet-utils'; +import { type AccountType, type NetworkSymbol, networks } from '@suite-common/wallet-config'; import { Account, AccountKey } from '@suite-common/wallet-types'; -import { type AccountType, networks, type NetworkSymbol } from '@suite-common/wallet-config'; +import { enhanceHistory, isTestnet, isUtxoBased } from '@suite-common/wallet-utils'; import { DeviceState, StaticSessionId } from '@trezor/connect'; import { accountsActions } from './accountsActions'; import { formattedAccountTypeMap } from './accountsConstants'; +import { deviceActions } from '../device/deviceActions'; import { DeviceRootState, - selectSelectedDevice, selectDeviceState, selectHasOnlyPortfolioDevice, + selectSelectedDevice, } from '../device/deviceReducer'; -import { deviceActions } from '../device/deviceActions'; import { DiscoveryRootState, selectHasDeviceDiscovery, diff --git a/suite-common/wallet-core/src/accounts/accountsThunks.ts b/suite-common/wallet-core/src/accounts/accountsThunks.ts index f194d7ac9e5..ab033c63ec7 100644 --- a/suite-common/wallet-core/src/accounts/accountsThunks.ts +++ b/suite-common/wallet-core/src/accounts/accountsThunks.ts @@ -1,28 +1,28 @@ -import TrezorConnect, { AccountInfo, TokenInfo } from '@trezor/connect'; -import { Account, AccountKey } from '@suite-common/wallet-types'; +import { createThunk } from '@suite-common/redux-utils'; +import { getTxsPerPage } from '@suite-common/suite-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { networksCollection } from '@suite-common/wallet-config'; +import { Account, AccountKey } from '@suite-common/wallet-types'; import { analyzeTransactions, findAccountDevice, formatNetworkAmount, formatTokenAmount, - tryGetAccountIdentity, getAccountTransactions, getAreSatoshisUsed, isAccountOutdated, isPending, isTrezorConnectBackendType, + tryGetAccountIdentity, } from '@suite-common/wallet-utils'; -import { getTxsPerPage } from '@suite-common/suite-utils'; -import { createThunk } from '@suite-common/redux-utils'; -import { notificationsActions } from '@suite-common/toast-notifications'; +import TrezorConnect, { AccountInfo, TokenInfo } from '@trezor/connect'; -import { transactionsActions } from '../transactions/transactionsActions'; -import { selectTransactions } from '../transactions/transactionsReducer'; import { accountsActions } from './accountsActions'; -import { selectAccountByKey, selectAccounts } from './accountsReducer'; import { ACCOUNTS_MODULE_PREFIX } from './accountsConstants'; +import { selectAccountByKey, selectAccounts } from './accountsReducer'; import { selectBlockchainHeightBySymbol } from '../blockchain/blockchainReducer'; +import { transactionsActions } from '../transactions/transactionsActions'; +import { selectTransactions } from '../transactions/transactionsReducer'; export const disableAccountsThunk = createThunk( `${ACCOUNTS_MODULE_PREFIX}/disableAccountsThunk`, diff --git a/suite-common/wallet-core/src/accounts/tests/accountsReducer.test.ts b/suite-common/wallet-core/src/accounts/tests/accountsReducer.test.ts index d2ab0983956..31ad2f20512 100644 --- a/suite-common/wallet-core/src/accounts/tests/accountsReducer.test.ts +++ b/suite-common/wallet-core/src/accounts/tests/accountsReducer.test.ts @@ -2,8 +2,8 @@ import { combineReducers } from '@reduxjs/toolkit'; import { ExtraDependenciesPartial } from '@suite-common/redux-utils'; import { configureMockStore, extraDependenciesMock } from '@suite-common/test-utils'; -import { Account } from '@suite-common/wallet-types'; import { Bip43Path } from '@suite-common/wallet-config'; +import { Account } from '@suite-common/wallet-types'; import { accountsActions } from '../accountsActions'; import { AccountsRootState, prepareAccountsReducer } from '../accountsReducer'; diff --git a/suite-common/wallet-core/src/accounts/tests/accountsThunks.test.ts b/suite-common/wallet-core/src/accounts/tests/accountsThunks.test.ts index f0e262c16e4..717203e8ac8 100644 --- a/suite-common/wallet-core/src/accounts/tests/accountsThunks.test.ts +++ b/suite-common/wallet-core/src/accounts/tests/accountsThunks.test.ts @@ -1,11 +1,11 @@ import { combineReducers } from '@reduxjs/toolkit'; +import { ExtraDependenciesPartial } from '@suite-common/redux-utils'; import { configureMockStore, extraDependenciesMock } from '@suite-common/test-utils'; import { Account } from '@suite-common/wallet-types'; -import { ExtraDependenciesPartial } from '@suite-common/redux-utils'; -import { disableAccountsThunk } from '../accountsThunks'; import { AccountsRootState, prepareAccountsReducer } from '../accountsReducer'; +import { disableAccountsThunk } from '../accountsThunks'; const accountsReducer = prepareAccountsReducer(extraDependenciesMock); diff --git a/suite-common/wallet-core/src/blockchain/__tests__/blockchainReducer.test.ts b/suite-common/wallet-core/src/blockchain/__tests__/blockchainReducer.test.ts index ff518ac705a..b59b49f67b8 100644 --- a/suite-common/wallet-core/src/blockchain/__tests__/blockchainReducer.test.ts +++ b/suite-common/wallet-core/src/blockchain/__tests__/blockchainReducer.test.ts @@ -1,8 +1,8 @@ -import { BackendSettings } from '@suite-common/wallet-types'; import { extraDependenciesMock } from '@suite-common/test-utils'; +import { BackendSettings } from '@suite-common/wallet-types'; +import { SetBackendPayload, blockchainActions } from '../blockchainActions'; import { blockchainInitialState, prepareBlockchainReducer } from '../blockchainReducer'; -import { blockchainActions, SetBackendPayload } from '../blockchainActions'; const blockchainReducer = prepareBlockchainReducer(extraDependenciesMock); diff --git a/suite-common/wallet-core/src/blockchain/blockchainMiddleware.ts b/suite-common/wallet-core/src/blockchain/blockchainMiddleware.ts index 8d2b7a0a479..8236b18cfe1 100644 --- a/suite-common/wallet-core/src/blockchain/blockchainMiddleware.ts +++ b/suite-common/wallet-core/src/blockchain/blockchainMiddleware.ts @@ -1,14 +1,14 @@ import { getUnixTime } from 'date-fns'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; -import { BLOCKCHAIN as TREZOR_CONNECT_BLOCKCHAIN_ACTIONS, BlockchainEvent } from '@trezor/connect'; +import { BlockchainEvent, BLOCKCHAIN as TREZOR_CONNECT_BLOCKCHAIN_ACTIONS } from '@trezor/connect'; import { - onBlockchainConnectThunk, onBlockMinedThunk, + onBlockchainConnectThunk, + onBlockchainDisconnectThunk, onBlockchainNotificationThunk, updateFeeInfoThunk, - onBlockchainDisconnectThunk, } from './blockchainThunks'; export const prepareBlockchainMiddleware = createMiddlewareWithExtraDeps( diff --git a/suite-common/wallet-core/src/blockchain/blockchainReducer.ts b/suite-common/wallet-core/src/blockchain/blockchainReducer.ts index a58ff453a8b..4e2e5c2fec7 100644 --- a/suite-common/wallet-core/src/blockchain/blockchainReducer.ts +++ b/suite-common/wallet-core/src/blockchain/blockchainReducer.ts @@ -3,17 +3,17 @@ import { PayloadAction } from '@reduxjs/toolkit'; import { createReducerWithExtraDeps, createWeakMapSelector } from '@suite-common/redux-utils'; import { type BackendType, + type NetworkSymbol, getNetworkOptional, networksCollection, - type NetworkSymbol, } from '@suite-common/wallet-config'; import { Blockchain, BlockchainNetworks } from '@suite-common/wallet-types'; import { - BLOCKCHAIN as TREZOR_CONNECT_BLOCKCHAIN_ACTIONS, BlockchainBlock, BlockchainError, - BlockchainReconnecting, BlockchainInfo, + BlockchainReconnecting, + BLOCKCHAIN as TREZOR_CONNECT_BLOCKCHAIN_ACTIONS, } from '@trezor/connect'; import { blockchainActions } from './blockchainActions'; diff --git a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts index 62ac596fa04..810f7f41a27 100644 --- a/suite-common/wallet-core/src/blockchain/blockchainThunks.ts +++ b/suite-common/wallet-core/src/blockchain/blockchainThunks.ts @@ -1,24 +1,26 @@ import { createThunk } from '@suite-common/redux-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { + NetworkSymbol, getNetworkOptional, isBlockbookBasedNetwork, isNetworkSymbol, networksCollection, - NetworkSymbol, } from '@suite-common/wallet-config'; +import type { Account, CustomBackend, NetworksFees } from '@suite-common/wallet-types'; import { findAccountDevice, findAccountsByDescriptor, findAccountsByNetwork, formatNetworkAmount, formatTokenAmount, + getAccountIdentity, getAreSatoshisUsed, getBackendFromSettings, getCustomBackends, isTrezorConnectBackendType, - shouldUseIdentities, - getAccountIdentity, shouldSubscribeBlocks, + shouldUseIdentities, } from '@suite-common/wallet-utils'; import TrezorConnect, { BlockchainBlock, @@ -26,15 +28,13 @@ import TrezorConnect, { BlockchainNotification, FeeLevel, } from '@trezor/connect'; -import { arrayDistinct, arrayToDictionary } from '@trezor/utils'; -import type { Account, CustomBackend, NetworksFees } from '@suite-common/wallet-types'; import type { TimerId } from '@trezor/type-utils'; -import { notificationsActions } from '@suite-common/toast-notifications'; +import { arrayDistinct, arrayToDictionary } from '@trezor/utils'; -import { selectAccounts } from '../accounts/accountsReducer'; -import { fetchAndUpdateAccountThunk } from '../accounts/accountsThunks'; import { BLOCKCHAIN_MODULE_PREFIX, blockchainActions } from './blockchainActions'; import { selectBlockchainState, selectNetworkBlockchainInfo } from './blockchainReducer'; +import { selectAccounts } from '../accounts/accountsReducer'; +import { fetchAndUpdateAccountThunk } from '../accounts/accountsThunks'; import { selectNetworkFeeInfo } from '../fees/feesReducer'; export const DEFAULT_ACCOUNT_SYNC_INTERVAL = 60 * 1000; // 1 minute diff --git a/suite-common/wallet-core/src/device/deviceActions.ts b/suite-common/wallet-core/src/device/deviceActions.ts index cfb0a51cbed..1020a5cbc23 100644 --- a/suite-common/wallet-core/src/device/deviceActions.ts +++ b/suite-common/wallet-core/src/device/deviceActions.ts @@ -1,8 +1,8 @@ import { createAction } from '@reduxjs/toolkit'; -import { Device, DEVICE } from '@trezor/connect'; import { ButtonRequest, TrezorDevice } from '@suite-common/suite-types'; import { WalletType } from '@suite-common/wallet-types'; +import { DEVICE, Device } from '@trezor/connect'; export const DEVICE_MODULE_PREFIX = '@suite/device'; diff --git a/suite-common/wallet-core/src/device/deviceReducer.ts b/suite-common/wallet-core/src/device/deviceReducer.ts index 0f74b5fa89c..8e66505549a 100644 --- a/suite-common/wallet-core/src/device/deviceReducer.ts +++ b/suite-common/wallet-core/src/device/deviceReducer.ts @@ -1,8 +1,19 @@ -import { isAnyOf } from '@reduxjs/toolkit'; import { A, pipe } from '@mobily/ts-belt'; +import { isAnyOf } from '@reduxjs/toolkit'; +import { + StoredAuthenticateDeviceResult, + deviceAuthenticityActions, +} from '@suite-common/device-authenticity'; +import { + createReducerWithExtraDeps, + createWeakMapSelector, + returnStableArrayIfEmpty, +} from '@suite-common/redux-utils'; +import { AcquiredDevice, ButtonRequest, TrezorDevice } from '@suite-common/suite-types'; import * as deviceUtils from '@suite-common/suite-utils'; import { getDeviceInstances, getFwUpdateVersion, getStatus } from '@suite-common/suite-utils'; +import { networkSymbolCollection } from '@suite-common/wallet-config'; import { Device, DeviceState, Features, StaticSessionId, UI } from '@trezor/connect'; import { getFirmwareVersion, @@ -10,26 +21,15 @@ import { hasBitcoinOnlyFirmware, isBitcoinOnlyDevice, } from '@trezor/device-utils'; -import { networkSymbolCollection } from '@suite-common/wallet-config'; -import { - createReducerWithExtraDeps, - createWeakMapSelector, - returnStableArrayIfEmpty, -} from '@suite-common/redux-utils'; -import { TrezorDevice, AcquiredDevice, ButtonRequest } from '@suite-common/suite-types'; -import { - deviceAuthenticityActions, - StoredAuthenticateDeviceResult, -} from '@suite-common/device-authenticity'; import { isNative } from '@trezor/env-utils'; +import { ConnectDeviceSettings, deviceActions } from './deviceActions'; +import { PORTFOLIO_TRACKER_DEVICE_ID } from './deviceConstants'; import { authorizeDeviceThunk, createDeviceInstanceThunk, createImportedDeviceThunk, } from './deviceThunks'; -import { ConnectDeviceSettings, deviceActions } from './deviceActions'; -import { PORTFOLIO_TRACKER_DEVICE_ID } from './deviceConstants'; const createMemoizedSelector = createWeakMapSelector.withTypes(); diff --git a/suite-common/wallet-core/src/device/deviceThunks.ts b/suite-common/wallet-core/src/device/deviceThunks.ts index a4a723579dc..5cc8adc2b65 100644 --- a/suite-common/wallet-core/src/device/deviceThunks.ts +++ b/suite-common/wallet-core/src/device/deviceThunks.ts @@ -1,26 +1,17 @@ import { AnyAction } from '@reduxjs/toolkit'; import { createThunk } from '@suite-common/redux-utils'; -import TrezorConnect, { - Device, - CardanoAddress, - Address, - Response as ConnectResponse, - UI, - DEVICE, - DeviceState, -} from '@trezor/connect'; import { TrezorDevice } from '@suite-common/suite-types'; -import { notificationsActions } from '@suite-common/toast-notifications'; import { - sortByTimestamp, - isChanged, - getSelectedDevice, - getNewInstanceNumber, getDeviceInstances, getFirstDeviceInstance, + getNewInstanceNumber, + getSelectedDevice, + isChanged, isDeviceAcquired, + sortByTimestamp, } from '@suite-common/suite-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { AccountKey, WalletType } from '@suite-common/wallet-types'; import { getAddressType, @@ -29,16 +20,25 @@ import { getProtocolMagic, getStakingPath, } from '@suite-common/wallet-utils'; +import TrezorConnect, { + Address, + CardanoAddress, + Response as ConnectResponse, + DEVICE, + Device, + DeviceState, + UI, +} from '@trezor/connect'; import { getEnvironment } from '@trezor/env-utils'; +import { DEVICE_MODULE_PREFIX, DeviceConnectActionPayload, deviceActions } from './deviceActions'; +import { PORTFOLIO_TRACKER_DEVICE_ID, portfolioTrackerDevice } from './deviceConstants'; import { - selectSelectedDevice, - selectSelectedDevice as selectDeviceSelector, selectDeviceById, + selectSelectedDevice as selectDeviceSelector, selectDevices, + selectSelectedDevice, } from './deviceReducer'; -import { deviceActions, DEVICE_MODULE_PREFIX, DeviceConnectActionPayload } from './deviceActions'; -import { PORTFOLIO_TRACKER_DEVICE_ID, portfolioTrackerDevice } from './deviceConstants'; import { selectAccountByKey } from '../accounts/accountsReducer'; type SelectDeviceThunkParams = { diff --git a/suite-common/wallet-core/src/discovery/discoveryReducer.ts b/suite-common/wallet-core/src/discovery/discoveryReducer.ts index 1c68674e40f..9cece262295 100644 --- a/suite-common/wallet-core/src/discovery/discoveryReducer.ts +++ b/suite-common/wallet-core/src/discovery/discoveryReducer.ts @@ -1,8 +1,8 @@ -import { createDeferred } from '@trezor/utils'; -import { Discovery, PartialDiscovery } from '@suite-common/wallet-types'; import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; import { DiscoveryStatus } from '@suite-common/wallet-constants'; +import { Discovery, PartialDiscovery } from '@suite-common/wallet-types'; import { DeviceState, StaticSessionId } from '@trezor/connect'; +import { createDeferred } from '@trezor/utils'; import { discoveryActions } from './discoveryActions'; import { DeviceRootState, selectSelectedDevice } from '../device/deviceReducer'; diff --git a/suite-common/wallet-core/src/discovery/discoveryThunks.ts b/suite-common/wallet-core/src/discovery/discoveryThunks.ts index 12359e488f8..623da079c85 100644 --- a/suite-common/wallet-core/src/discovery/discoveryThunks.ts +++ b/suite-common/wallet-core/src/discovery/discoveryThunks.ts @@ -1,24 +1,24 @@ -import { createThunk, ExtraDependencies } from '@suite-common/redux-utils'; -import { DiscoveryStatus } from '@suite-common/wallet-constants'; -import { notificationsActions } from '@suite-common/toast-notifications'; -import TrezorConnect, { AccountInfo, BundleProgress, StaticSessionId, UI } from '@trezor/connect'; +import { ExtraDependencies, createThunk } from '@suite-common/redux-utils'; import { TrezorDevice } from '@suite-common/suite-types'; -import { - tryGetAccountIdentity, - getDerivationType, - isTrezorConnectBackendType, - substituteBip43Path, -} from '@suite-common/wallet-utils'; -import { Discovery, DiscoveryItem, PartialDiscovery } from '@suite-common/wallet-types'; import { getTxsPerPage } from '@suite-common/suite-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { + Network, type NetworkAccount, type NetworkSymbol, - Network, + type NormalizedNetworkAccount, networksCollection, normalizeNetworkAccounts, - type NormalizedNetworkAccount, } from '@suite-common/wallet-config'; +import { DiscoveryStatus } from '@suite-common/wallet-constants'; +import { Discovery, DiscoveryItem, PartialDiscovery } from '@suite-common/wallet-types'; +import { + getDerivationType, + isTrezorConnectBackendType, + substituteBip43Path, + tryGetAccountIdentity, +} from '@suite-common/wallet-utils'; +import TrezorConnect, { AccountInfo, BundleProgress, StaticSessionId, UI } from '@trezor/connect'; import { getFirmwareVersion } from '@trezor/device-utils'; import { versionUtils } from '@trezor/utils'; @@ -32,12 +32,12 @@ import { updateDiscovery, } from './discoveryActions'; import { - selectDiscoveryByDeviceState, - selectDiscovery, selectDeviceDiscovery, + selectDiscovery, + selectDiscoveryByDeviceState, } from './discoveryReducer'; -import { selectAccounts } from '../accounts/accountsReducer'; import { accountsActions } from '../accounts/accountsActions'; +import { selectAccounts } from '../accounts/accountsReducer'; import { selectDeviceByStaticSessionId } from '../device/deviceReducer'; type ProgressEvent = BundleProgress['payload']; diff --git a/suite-common/wallet-core/src/fees/feesReducer.ts b/suite-common/wallet-core/src/fees/feesReducer.ts index 9ace481fc6b..e3b7e697603 100644 --- a/suite-common/wallet-core/src/fees/feesReducer.ts +++ b/suite-common/wallet-core/src/fees/feesReducer.ts @@ -1,11 +1,11 @@ import { createReducer } from '@reduxjs/toolkit'; +import { createWeakMapSelector } from '@suite-common/redux-utils'; +import { formatDuration } from '@suite-common/suite-utils'; import { NetworkSymbol, getNetworkType, networksCollection } from '@suite-common/wallet-config'; import { FeeInfo, FeeLevelLabel } from '@suite-common/wallet-types'; -import { formatDuration } from '@suite-common/suite-utils'; -import { createWeakMapSelector } from '@suite-common/redux-utils'; -import { FeeLevel } from '@trezor/connect'; import { getFeeInfo } from '@suite-common/wallet-utils'; +import { FeeLevel } from '@trezor/connect'; import { blockchainActions } from '../blockchain/blockchainActions'; diff --git a/suite-common/wallet-core/src/fiat-rates/fiatRatesMiddleware.ts b/suite-common/wallet-core/src/fiat-rates/fiatRatesMiddleware.ts index c2d36d1afa5..56713d1b6c7 100644 --- a/suite-common/wallet-core/src/fiat-rates/fiatRatesMiddleware.ts +++ b/suite-common/wallet-core/src/fiat-rates/fiatRatesMiddleware.ts @@ -1,8 +1,8 @@ import { isAnyOf } from '@reduxjs/toolkit'; -import { isNative } from '@trezor/env-utils'; import { createMiddlewareWithExtraDeps } from '@suite-common/redux-utils'; import { Timestamp, TokenAddress } from '@suite-common/wallet-types'; +import { isNative } from '@trezor/env-utils'; import { fetchFiatRatesThunk, @@ -10,8 +10,8 @@ import { updateMissingTxFiatRatesThunk, updateTxsFiatRatesThunk, } from './fiatRatesThunks'; -import { blockchainActions } from '../blockchain/blockchainActions'; import { accountsActions } from '../accounts/accountsActions'; +import { blockchainActions } from '../blockchain/blockchainActions'; import { transactionsActions } from '../transactions/transactionsActions'; import { fetchAllTransactionsForAccountThunk } from '../transactions/transactionsThunks'; diff --git a/suite-common/wallet-core/src/fiat-rates/fiatRatesSelectors.ts b/suite-common/wallet-core/src/fiat-rates/fiatRatesSelectors.ts index fa1d53ae5b9..4563215290e 100644 --- a/suite-common/wallet-core/src/fiat-rates/fiatRatesSelectors.ts +++ b/suite-common/wallet-core/src/fiat-rates/fiatRatesSelectors.ts @@ -1,18 +1,22 @@ import { A, D, F, pipe } from '@mobily/ts-belt'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { + TokenDefinitionsRootState, + selectIsSpecificCoinDefinitionKnown, +} from '@suite-common/token-definitions'; import { Account, AccountKey, - WalletAccountTransaction, FiatRateKey, Rate, - TickerId, RateTypeWithoutHistoric, - Timestamp, - TokenAddress, RatesByKey, RatesByTimestamps, + TickerId, + Timestamp, + TokenAddress, + WalletAccountTransaction, } from '@suite-common/wallet-types'; import { getFiatRateKey, @@ -20,19 +24,15 @@ import { isNftTokenTransfer, roundTimestampToNearestPastHour, } from '@suite-common/wallet-utils'; -import { - TokenDefinitionsRootState, - selectIsSpecificCoinDefinitionKnown, -} from '@suite-common/token-definitions'; +import { MAX_AGE } from './fiatRatesConstants'; +import { FiatRatesRootState } from './fiatRatesTypes'; import { AccountsRootState, selectAccountByKey, selectDeviceAccounts, } from '../accounts/accountsReducer'; import { TransactionsRootState, selectTransactions } from '../transactions/transactionsReducer'; -import { MAX_AGE } from './fiatRatesConstants'; -import { FiatRatesRootState } from './fiatRatesTypes'; type UnixTimestamp = number; diff --git a/suite-common/wallet-core/src/fiat-rates/fiatRatesThunks.ts b/suite-common/wallet-core/src/fiat-rates/fiatRatesThunks.ts index 67a53df88f8..b9dd838b305 100644 --- a/suite-common/wallet-core/src/fiat-rates/fiatRatesThunks.ts +++ b/suite-common/wallet-core/src/fiat-rates/fiatRatesThunks.ts @@ -1,28 +1,28 @@ import { fetchCurrentFiatRates, fetchLastWeekFiatRates } from '@suite-common/fiat-services'; import { createThunk } from '@suite-common/redux-utils'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { selectIsSpecificCoinDefinitionKnown } from '@suite-common/token-definitions'; +import { getNetworkFeatures } from '@suite-common/wallet-config'; import { + AccountKey, + RateTypeWithoutHistoric, TickerId, + TickerResult, Timestamp, TokenAddress, WalletAccountTransaction, - RateTypeWithoutHistoric, - TickerResult, - AccountKey, } from '@suite-common/wallet-types'; import { fetchTransactionsRates, groupTokensTransactionsByContractAddress, isTestnet, } from '@suite-common/wallet-utils'; -import { getNetworkFeatures } from '@suite-common/wallet-config'; -import { selectIsSpecificCoinDefinitionKnown } from '@suite-common/token-definitions'; import { TimerId } from '@trezor/type-utils'; import { FIAT_RATES_MODULE_PREFIX, REFETCH_INTERVAL } from './fiatRatesConstants'; import { selectTickersToBeUpdated, selectTransactionsWithMissingRates } from './fiatRatesSelectors'; -import { selectIsElectrumBackendSelected } from '../blockchain/blockchainSelectors'; import { selectAccountByKey } from '../accounts/accountsReducer'; +import { selectIsElectrumBackendSelected } from '../blockchain/blockchainSelectors'; type UpdateTxsFiatRatesThunkPayload = { accountKey: AccountKey; diff --git a/suite-common/wallet-core/src/send/sendFormActions.ts b/suite-common/wallet-core/src/send/sendFormActions.ts index c44e078a67b..921d242c699 100644 --- a/suite-common/wallet-core/src/send/sendFormActions.ts +++ b/suite-common/wallet-core/src/send/sendFormActions.ts @@ -1,8 +1,8 @@ import { createAction } from '@reduxjs/toolkit'; import { - FormState, AccountKey, + FormState, GeneralPrecomposedTransactionFinal, TokenAddress, } from '@suite-common/wallet-types'; diff --git a/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts b/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts index d6f98e8b390..e1503f02b77 100644 --- a/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts @@ -1,21 +1,6 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import TrezorConnect, { - FeeLevel, - Params, - SignTransaction, - SignedTransaction, - DEFAULT_SORTING_STRATEGY, -} from '@trezor/connect'; -import { notificationsActions } from '@suite-common/toast-notifications'; -import { - formatNetworkAmount, - getBitcoinComposeOutputs, - hasNetworkFeatures, - restoreOrigOutputsOrder, - getUtxoOutpoint, - isRbfTransaction, -} from '@suite-common/wallet-utils'; +import { createThunk } from '@suite-common/redux-utils'; import { BITCOIN_ONLY_SYMBOLS, BitcoinOnlySymbolsItemType } from '@suite-common/suite-constants'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { BTC_LOCKTIME_SEQUENCE, BTC_RBF_SEQUENCE } from '@suite-common/wallet-constants'; import { Account, @@ -24,17 +9,32 @@ import { PrecomposedLevels, PrecomposedTransaction, } from '@suite-common/wallet-types'; -import { createThunk } from '@suite-common/redux-utils'; +import { + formatNetworkAmount, + getBitcoinComposeOutputs, + getUtxoOutpoint, + hasNetworkFeatures, + isRbfTransaction, + restoreOrigOutputsOrder, +} from '@suite-common/wallet-utils'; +import TrezorConnect, { + DEFAULT_SORTING_STRATEGY, + FeeLevel, + Params, + SignTransaction, + SignedTransaction, +} from '@trezor/connect'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { selectTransactions } from '../transactions/transactionsReducer'; -import { selectSelectedDevice } from '../device/deviceReducer'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { - ComposeTransactionThunkArguments, ComposeFeeLevelsError, - SignTransactionThunkArguments, + ComposeTransactionThunkArguments, SignTransactionError, + SignTransactionThunkArguments, } from './sendFormTypes'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; +import { selectSelectedDevice } from '../device/deviceReducer'; +import { selectTransactions } from '../transactions/transactionsReducer'; type GetSequenceParams = { account: Account; formValues: FormState }; diff --git a/suite-common/wallet-core/src/send/sendFormCardanoThunks.ts b/suite-common/wallet-core/src/send/sendFormCardanoThunks.ts index 1d2c09a5fc8..49990499999 100644 --- a/suite-common/wallet-core/src/send/sendFormCardanoThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormCardanoThunks.ts @@ -1,28 +1,28 @@ -import TrezorConnect, { PROTO, PrecomposedTransactionFinalCardano } from '@trezor/connect'; +import { createThunk } from '@suite-common/redux-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; import { - isTestnet, - getDerivationType, - getUnusedChangeAddress, + PrecomposedLevelsCardano, + PrecomposedTransactionCardano, +} from '@suite-common/wallet-types'; +import { + formatMaxOutputAmount, getAddressParameters, + getDerivationType, getNetworkId, getProtocolMagic, + getUnusedChangeAddress, + isTestnet, transformUserOutputs, - formatMaxOutputAmount, } from '@suite-common/wallet-utils'; -import { notificationsActions } from '@suite-common/toast-notifications'; -import { - PrecomposedLevelsCardano, - PrecomposedTransactionCardano, -} from '@suite-common/wallet-types'; -import { createThunk } from '@suite-common/redux-utils'; +import TrezorConnect, { PROTO, PrecomposedTransactionFinalCardano } from '@trezor/connect'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { - ComposeTransactionThunkArguments, ComposeFeeLevelsError, + ComposeTransactionThunkArguments, SignTransactionError, SignTransactionThunkArguments, } from './sendFormTypes'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; export const composeCardanoTransactionFeeLevelsThunk = createThunk< PrecomposedLevelsCardano, diff --git a/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts b/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts index 1549a5f8224..0209a619072 100644 --- a/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormEthereumThunks.ts @@ -1,44 +1,44 @@ import { fromWei, toWei } from 'web3-utils'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import TrezorConnect, { FeeLevel, TokenInfo } from '@trezor/connect'; -import { notificationsActions } from '@suite-common/toast-notifications'; -import { - calculateTotal, - calculateMax, - calculateEthFee, - getEthereumEstimateFeeParams, - prepareEthereumTransaction, - getExternalComposeOutput, - amountToSmallestUnit, - formatAmount, - isPending, - getAccountIdentity, - getTxStakeNameByDataHex, - getUnstakeAmountByEthereumDataHex, -} from '@suite-common/wallet-utils'; import { createThunk } from '@suite-common/redux-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; +import { getNetwork, getNetworkDisplaySymbol } from '@suite-common/wallet-config'; import { ERC20_BACKUP_GAS_LIMIT, ETH_BACKUP_GAS_LIMIT, STAKE_GAS_LIMIT_RESERVE, } from '@suite-common/wallet-constants'; import { + AddressDisplayOptions, + ExternalOutput, PrecomposedLevels, PrecomposedTransaction, - ExternalOutput, - AddressDisplayOptions, } from '@suite-common/wallet-types'; -import { getNetwork, getNetworkDisplaySymbol } from '@suite-common/wallet-config'; +import { + amountToSmallestUnit, + calculateEthFee, + calculateMax, + calculateTotal, + formatAmount, + getAccountIdentity, + getEthereumEstimateFeeParams, + getExternalComposeOutput, + getTxStakeNameByDataHex, + getUnstakeAmountByEthereumDataHex, + isPending, + prepareEthereumTransaction, +} from '@suite-common/wallet-utils'; +import TrezorConnect, { FeeLevel, TokenInfo } from '@trezor/connect'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { selectTransactions } from '../transactions/transactionsReducer'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { - ComposeTransactionThunkArguments, ComposeFeeLevelsError, - SignTransactionThunkArguments, + ComposeTransactionThunkArguments, SignTransactionError, + SignTransactionThunkArguments, } from './sendFormTypes'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; +import { selectTransactions } from '../transactions/transactionsReducer'; const calculate = ( availableBalance: string, diff --git a/suite-common/wallet-core/src/send/sendFormReducer.ts b/suite-common/wallet-core/src/send/sendFormReducer.ts index e199ec6e87e..5f86d3fa20f 100644 --- a/suite-common/wallet-core/src/send/sendFormReducer.ts +++ b/suite-common/wallet-core/src/send/sendFormReducer.ts @@ -1,5 +1,7 @@ import { G } from '@mobily/ts-belt'; +import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; +import { type NetworkSymbol, getNetworkType } from '@suite-common/wallet-config'; import { AccountKey, FormState, @@ -8,21 +10,19 @@ import { SendFormDraftKey, TokenAddress, } from '@suite-common/wallet-types'; -import { cloneObject } from '@trezor/utils'; -import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; +import { getSendFormDraftKey } from '@suite-common/wallet-utils'; import { BlockbookTransaction } from '@trezor/blockchain-link-types'; -import { type NetworkSymbol, getNetworkType } from '@suite-common/wallet-config'; import { DeviceModelInternal } from '@trezor/connect'; -import { getSendFormDraftKey } from '@suite-common/wallet-utils'; +import { cloneObject } from '@trezor/utils'; import { sendFormActions } from './sendFormActions'; +import { SerializedTx } from './sendFormTypes'; import { accountsActions } from '../accounts/accountsActions'; import { DeviceRootState, selectDeviceButtonRequestsCodes, selectDeviceModel, } from '../device/deviceReducer'; -import { SerializedTx } from './sendFormTypes'; export type SendState = { drafts: { diff --git a/suite-common/wallet-core/src/send/sendFormRippleThunks.ts b/suite-common/wallet-core/src/send/sendFormRippleThunks.ts index 30fd1fc02d8..0e34fc38931 100644 --- a/suite-common/wallet-core/src/send/sendFormRippleThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormRippleThunks.ts @@ -1,28 +1,28 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import TrezorConnect, { FeeLevel, RipplePayment } from '@trezor/connect'; -import { - calculateTotal, - calculateMax, - getExternalComposeOutput, - networkAmountToSmallestUnit, - formatNetworkAmount, -} from '@suite-common/wallet-utils'; +import { createThunk } from '@suite-common/redux-utils'; import { XRP_FLAG } from '@suite-common/wallet-constants'; import { + AddressDisplayOptions, + ExternalOutput, PrecomposedLevels, PrecomposedTransaction, - ExternalOutput, - AddressDisplayOptions, } from '@suite-common/wallet-types'; -import { createThunk } from '@suite-common/redux-utils'; +import { + calculateMax, + calculateTotal, + formatNetworkAmount, + getExternalComposeOutput, + networkAmountToSmallestUnit, +} from '@suite-common/wallet-utils'; +import TrezorConnect, { FeeLevel, RipplePayment } from '@trezor/connect'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { - ComposeTransactionThunkArguments, ComposeFeeLevelsError, - SignTransactionThunkArguments, + ComposeTransactionThunkArguments, SignTransactionError, + SignTransactionThunkArguments, } from './sendFormTypes'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; const calculate = ( availableBalance: string, diff --git a/suite-common/wallet-core/src/send/sendFormSolanaThunks.ts b/suite-common/wallet-core/src/send/sendFormSolanaThunks.ts index 459d42d5415..07a7e2b48b1 100644 --- a/suite-common/wallet-core/src/send/sendFormSolanaThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormSolanaThunks.ts @@ -1,14 +1,11 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import TrezorConnect, { FeeLevel } from '@trezor/connect'; -import type { TokenInfo } from '@trezor/blockchain-link-types'; -import { tokenStandardToTokenProgramName } from '@trezor/blockchain-link-utils/src/solana'; +import { createThunk } from '@suite-common/redux-utils'; +import { getNetworkDisplaySymbol } from '@suite-common/wallet-config'; import { + Account, ExternalOutput, - PrecomposedTransaction, PrecomposedLevels, - Account, + PrecomposedTransaction, } from '@suite-common/wallet-types'; -import { createThunk } from '@suite-common/redux-utils'; import { amountToSmallestUnit, calculateMax, @@ -17,16 +14,19 @@ import { getAccountIdentity, getExternalComposeOutput, } from '@suite-common/wallet-utils'; -import { getNetworkDisplaySymbol } from '@suite-common/wallet-config'; +import type { TokenInfo } from '@trezor/blockchain-link-types'; +import { tokenStandardToTokenProgramName } from '@trezor/blockchain-link-utils/src/solana'; +import TrezorConnect, { FeeLevel } from '@trezor/connect'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { selectBlockchainBlockInfoBySymbol } from '../blockchain/blockchainReducer'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { - ComposeTransactionThunkArguments, ComposeFeeLevelsError, - SignTransactionThunkArguments, + ComposeTransactionThunkArguments, SignTransactionError, + SignTransactionThunkArguments, } from './sendFormTypes'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; +import { selectBlockchainBlockInfoBySymbol } from '../blockchain/blockchainReducer'; const calculate = ( availableBalance: string, diff --git a/suite-common/wallet-core/src/send/sendFormThunks.ts b/suite-common/wallet-core/src/send/sendFormThunks.ts index 5ae5b5998a4..46d7584fd15 100644 --- a/suite-common/wallet-core/src/send/sendFormThunks.ts +++ b/suite-common/wallet-core/src/send/sendFormThunks.ts @@ -2,8 +2,9 @@ import { G } from '@mobily/ts-belt'; import { isRejected } from '@reduxjs/toolkit'; import { ActionsFromAsyncThunk } from '@reduxjs/toolkit/dist/matchers'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { createThunk } from '@suite-common/redux-utils'; +import { notificationsActions } from '@suite-common/toast-notifications'; +import { NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; import { Account, AccountKey, @@ -15,64 +16,63 @@ import { PrecomposedTransactionFinalCardano, PrecomposedTransactionFinalRbf, } from '@suite-common/wallet-types'; -import { notificationsActions } from '@suite-common/toast-notifications'; -import { getNetwork, NetworkSymbol } from '@suite-common/wallet-config'; import { - hasNetworkFeatures, amountToSmallestUnit, formatAmount, + formatNetworkAmount, getAccountDecimals, getAreSatoshisUsed, - formatNetworkAmount, getPendingAccount, + hasNetworkFeatures, isCardanoTx, tryGetAccountIdentity, } from '@suite-common/wallet-utils'; +import { BlockbookTransaction } from '@trezor/blockchain-link-types'; import TrezorConnect, { Success } from '@trezor/connect'; import { cloneObject } from '@trezor/utils'; -import { BlockbookTransaction } from '@trezor/blockchain-link-types'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { - addFakePendingCardanoTxThunk, - addFakePendingTxThunk, -} from '../transactions/transactionsThunks'; -import { accountsActions } from '../accounts/accountsActions'; -import { selectAccountByKey } from '../accounts/accountsReducer'; -import { selectSelectedDevice } from '../device/deviceReducer'; -import { syncAccountsWithBlockchainThunk } from '../blockchain/blockchainThunks'; -import { - selectSendFormDrafts, - selectSendSerializedTx, - selectSendPrecomposedTx, -} from './sendFormReducer'; import { sendFormActions } from './sendFormActions'; import { - signBitcoinSendFormTransactionThunk, composeBitcoinTransactionFeeLevelsThunk, + signBitcoinSendFormTransactionThunk, } from './sendFormBitcoinThunks'; import { - signEthereumSendFormTransactionThunk, + composeCardanoTransactionFeeLevelsThunk, + signCardanoSendFormTransactionThunk, +} from './sendFormCardanoThunks'; +import { SEND_MODULE_PREFIX } from './sendFormConstants'; +import { composeEthereumTransactionFeeLevelsThunk, + signEthereumSendFormTransactionThunk, } from './sendFormEthereumThunks'; import { - signCardanoSendFormTransactionThunk, - composeCardanoTransactionFeeLevelsThunk, -} from './sendFormCardanoThunks'; + selectSendFormDrafts, + selectSendPrecomposedTx, + selectSendSerializedTx, +} from './sendFormReducer'; import { composeRippleTransactionFeeLevelsThunk, signRippleSendFormTransactionThunk, } from './sendFormRippleThunks'; import { - signSolanaSendFormTransactionThunk, composeSolanaTransactionFeeLevelsThunk, + signSolanaSendFormTransactionThunk, } from './sendFormSolanaThunks'; -import { SEND_MODULE_PREFIX } from './sendFormConstants'; import { ComposeActionContext, ComposeFeeLevelsError, PushTransactionError, SignTransactionError, } from './sendFormTypes'; +import { accountsActions } from '../accounts/accountsActions'; +import { selectAccountByKey } from '../accounts/accountsReducer'; +import { syncAccountsWithBlockchainThunk } from '../blockchain/blockchainThunks'; +import { selectSelectedDevice } from '../device/deviceReducer'; +import { + addFakePendingCardanoTxThunk, + addFakePendingTxThunk, +} from '../transactions/transactionsThunks'; export const convertSendFormDraftsBtcAmountUnitsThunk = createThunk( `${SEND_MODULE_PREFIX}/convertSendFormDraftsBtcAmountUnitsThunk`, diff --git a/suite-common/wallet-core/src/send/sendFormTypes.ts b/suite-common/wallet-core/src/send/sendFormTypes.ts index 111c882c726..5a8a856c36b 100644 --- a/suite-common/wallet-core/src/send/sendFormTypes.ts +++ b/suite-common/wallet-core/src/send/sendFormTypes.ts @@ -1,14 +1,14 @@ +import { TrezorDevice } from '@suite-common/suite-types'; +import { Network, NetworkSymbol } from '@suite-common/wallet-config'; import { Account, - FeeInfo, - WalletAccountTransaction, - PrecomposedTransactionFinal, ExcludedUtxos, + FeeInfo, FormState, + PrecomposedTransactionFinal, + WalletAccountTransaction, } from '@suite-common/wallet-types'; -import { TokenInfo, Unsuccessful, ERRORS as CONNECT_ERRORS } from '@trezor/connect'; -import { Network, NetworkSymbol } from '@suite-common/wallet-config'; -import { TrezorDevice } from '@suite-common/suite-types'; +import { ERRORS as CONNECT_ERRORS, TokenInfo, Unsuccessful } from '@trezor/connect'; export type SerializedTx = { tx: string; symbol: NetworkSymbol }; diff --git a/suite-common/wallet-core/src/stake/stakeActions.ts b/suite-common/wallet-core/src/stake/stakeActions.ts index a3a211be953..8f627bb0823 100644 --- a/suite-common/wallet-core/src/stake/stakeActions.ts +++ b/suite-common/wallet-core/src/stake/stakeActions.ts @@ -1,7 +1,7 @@ import { createAction } from '@reduxjs/toolkit'; import { type NetworkSymbol } from '@suite-common/wallet-config'; -import { StakeFormState, PrecomposedTransactionFinal } from '@suite-common/wallet-types'; +import { PrecomposedTransactionFinal, StakeFormState } from '@suite-common/wallet-types'; export const STAKE_MODULE_PREFIX = '@common/wallet-core/stake'; diff --git a/suite-common/wallet-core/src/stake/stakeReducer.ts b/suite-common/wallet-core/src/stake/stakeReducer.ts index 6079d411dd2..f836c3db5b3 100644 --- a/suite-common/wallet-core/src/stake/stakeReducer.ts +++ b/suite-common/wallet-core/src/stake/stakeReducer.ts @@ -1,11 +1,11 @@ import { createReducerWithExtraDeps } from '@suite-common/redux-utils'; -import { Timestamp, StakeFormState, PrecomposedTransactionFinal } from '@suite-common/wallet-types'; -import { cloneObject } from '@trezor/utils'; import { NetworkSymbol } from '@suite-common/wallet-config'; +import { PrecomposedTransactionFinal, StakeFormState, Timestamp } from '@suite-common/wallet-types'; +import { cloneObject } from '@trezor/utils'; import { stakeActions } from './stakeActions'; -import { ValidatorsQueue } from './stakeTypes'; import { fetchEverstakeAssetData, fetchEverstakeData } from './stakeThunks'; +import { ValidatorsQueue } from './stakeTypes'; import { SerializedTx } from '../send/sendFormTypes'; export interface StakeState { diff --git a/suite-common/wallet-core/src/stake/stakeThunks.ts b/suite-common/wallet-core/src/stake/stakeThunks.ts index deb0cafdc48..e64532804a5 100644 --- a/suite-common/wallet-core/src/stake/stakeThunks.ts +++ b/suite-common/wallet-core/src/stake/stakeThunks.ts @@ -1,16 +1,17 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { createThunk } from '@suite-common/redux-utils'; -import { TimerId } from '@trezor/type-utils'; +import { + SupportedEthereumNetworkSymbol, + SupportedSolanaNetworkSymbols, +} from '@suite-common/wallet-types'; import { getSolanaStakingSymbols, getStakingSymbols, isSupportedSolStakingNetworkSymbol, } from '@suite-common/wallet-utils'; -import { - SupportedEthereumNetworkSymbol, - SupportedSolanaNetworkSymbols, -} from '@suite-common/wallet-types'; +import { TimerId } from '@trezor/type-utils'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; +import { EVERSTAKE_ENDPOINT_PREFIX } from './stakeConstants'; import { selectEverstakeData } from './stakeSelectors'; import { EVERSTAKE_ASSET_ENDPOINT_TYPES, @@ -19,7 +20,6 @@ import { EverstakeEndpointType, ValidatorsQueue, } from './stakeTypes'; -import { EVERSTAKE_ENDPOINT_PREFIX } from './stakeConstants'; import { selectAllNetworkSymbolsOfVisibleAccounts } from '../accounts/accountsReducer'; const STAKE_MODULE = '@common/wallet-core/stake'; diff --git a/suite-common/wallet-core/src/stake/stakeTypes.ts b/suite-common/wallet-core/src/stake/stakeTypes.ts index 7e03b6cb642..2d6a089bdea 100644 --- a/suite-common/wallet-core/src/stake/stakeTypes.ts +++ b/suite-common/wallet-core/src/stake/stakeTypes.ts @@ -1,14 +1,14 @@ -import { UseFormReturn, FormState as ReactHookFormState } from 'react-hook-form'; +import { FormState as ReactHookFormState, UseFormReturn } from 'react-hook-form'; +import { FiatCurrencyCode } from '@suite-common/suite-config'; import type { Network } from '@suite-common/wallet-config'; import { Account, - Rate, FeeInfo, - StakeFormState, PrecomposedLevels, + Rate, + StakeFormState, } from '@suite-common/wallet-types'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; import { FeeLevel } from '@trezor/connect'; export enum EverstakeEndpointType { diff --git a/suite-common/wallet-core/src/transactions/__fixtures__/transactionsReducer.ts b/suite-common/wallet-core/src/transactions/__fixtures__/transactionsReducer.ts index 432df5d6a4e..798738aa9fc 100644 --- a/suite-common/wallet-core/src/transactions/__fixtures__/transactionsReducer.ts +++ b/suite-common/wallet-core/src/transactions/__fixtures__/transactionsReducer.ts @@ -1,7 +1,7 @@ import { testMocks } from '@suite-common/test-utils'; -import type { TransactionsState } from '../transactionsReducer'; import type { transactionsActions } from '../transactionsActions'; +import type { TransactionsState } from '../transactionsReducer'; const ACCOUNT = testMocks.getWalletAccount(); diff --git a/suite-common/wallet-core/src/transactions/__tests__/transactionsReducer.test.ts b/suite-common/wallet-core/src/transactions/__tests__/transactionsReducer.test.ts index 1f1fb6d82dd..d57194b2c19 100644 --- a/suite-common/wallet-core/src/transactions/__tests__/transactionsReducer.test.ts +++ b/suite-common/wallet-core/src/transactions/__tests__/transactionsReducer.test.ts @@ -1,8 +1,8 @@ import { extraDependenciesMock } from '@suite-common/test-utils'; -import { transactionsInitialState, prepareTransactionsReducer } from '../transactionsReducer'; -import { transactionsActions } from '../transactionsActions'; import * as fixtures from '../__fixtures__/transactionsReducer'; +import { transactionsActions } from '../transactionsActions'; +import { prepareTransactionsReducer, transactionsInitialState } from '../transactionsReducer'; const transactionsReducer = prepareTransactionsReducer(extraDependenciesMock); diff --git a/suite-common/wallet-core/src/transactions/transactionsActions.ts b/suite-common/wallet-core/src/transactions/transactionsActions.ts index c98866c6fb6..fef9ed17997 100644 --- a/suite-common/wallet-core/src/transactions/transactionsActions.ts +++ b/suite-common/wallet-core/src/transactions/transactionsActions.ts @@ -1,8 +1,8 @@ import { createAction } from '@reduxjs/toolkit'; import { Account, WalletAccountTransaction } from '@suite-common/wallet-types'; -import { AccountTransaction } from '@trezor/connect'; import { enhanceTransaction } from '@suite-common/wallet-utils'; +import { AccountTransaction } from '@trezor/connect'; export const TRANSACTIONS_MODULE_PREFIX = '@common/wallet-core/transactions'; diff --git a/suite-common/wallet-core/src/transactions/transactionsReducer.ts b/suite-common/wallet-core/src/transactions/transactionsReducer.ts index 75497958ab9..adcfb7a525c 100644 --- a/suite-common/wallet-core/src/transactions/transactionsReducer.ts +++ b/suite-common/wallet-core/src/transactions/transactionsReducer.ts @@ -1,42 +1,42 @@ import { isAnyOf } from '@reduxjs/toolkit'; import { + createReducerWithExtraDeps, createWeakMapSelector, returnStableArrayIfEmpty, - createReducerWithExtraDeps, } from '@suite-common/redux-utils'; -import { Account, WalletAccountTransaction, AccountKey } from '@suite-common/wallet-types'; +import { + TokenDefinitionsRootState, + getIsPhishingTransaction, +} from '@suite-common/token-definitions'; +import { selectNetworkTokenDefinitions } from '@suite-common/token-definitions/src/tokenDefinitionsSelectors'; +import { Account, AccountKey, WalletAccountTransaction } from '@suite-common/wallet-types'; import { findTransaction, getConfirmations, - isPending, getEverstakePool, isClaimTx, + isPending, isStakeTx, isStakeTypeTx, isUnstakeTx, } from '@suite-common/wallet-utils'; -import { - getIsPhishingTransaction, - TokenDefinitionsRootState, -} from '@suite-common/token-definitions'; -import { selectNetworkTokenDefinitions } from '@suite-common/token-definitions/src/tokenDefinitionsSelectors'; -import { accountsActions } from '../accounts/accountsActions'; import { transactionsActions } from './transactionsActions'; import { - selectBlockchainHeightBySymbol, - BlockchainRootState, -} from '../blockchain/blockchainReducer'; -import { - fetchTransactionsPageThunk, fetchAllTransactionsForAccountThunk, + fetchTransactionsPageThunk, } from './transactionsThunks'; +import { accountsActions } from '../accounts/accountsActions'; import { AccountsRootState, selectAccountByKey, selectSolAccountHasStaked, } from '../accounts/accountsReducer'; +import { + BlockchainRootState, + selectBlockchainHeightBySymbol, +} from '../blockchain/blockchainReducer'; export type AccountTransactionsFetchStatusDetail = | { diff --git a/suite-common/wallet-core/src/transactions/transactionsThunks.ts b/suite-common/wallet-core/src/transactions/transactionsThunks.ts index ecbeb4ebcea..4d64c09c941 100644 --- a/suite-common/wallet-core/src/transactions/transactionsThunks.ts +++ b/suite-common/wallet-core/src/transactions/transactionsThunks.ts @@ -1,4 +1,5 @@ import { createSingleInstanceThunk, createThunk } from '@suite-common/redux-utils'; +import { getTxsPerPage } from '@suite-common/suite-utils'; import { Account, AccountKey, @@ -21,12 +22,7 @@ import { } from '@suite-common/wallet-utils'; import { blockbookUtils } from '@trezor/blockchain-link-utils'; import TrezorConnect, { AccountInfo } from '@trezor/connect'; -import { getTxsPerPage } from '@suite-common/suite-utils'; -import { accountsActions } from '../accounts/accountsActions'; -import { selectAccountByKey, selectAccounts } from '../accounts/accountsReducer'; -import { selectBlockchainHeightBySymbol } from '../blockchain/blockchainReducer'; -import { selectSendSignedTx } from '../send/sendFormReducer'; import { TRANSACTIONS_MODULE_PREFIX, transactionsActions } from './transactionsActions'; import { selectAccountTransactions, @@ -36,6 +32,10 @@ import { selectIsPageAlreadyFetched, selectTransactions, } from './transactionsReducer'; +import { accountsActions } from '../accounts/accountsActions'; +import { selectAccountByKey, selectAccounts } from '../accounts/accountsReducer'; +import { selectBlockchainHeightBySymbol } from '../blockchain/blockchainReducer'; +import { selectSendSignedTx } from '../send/sendFormReducer'; /** * Replace existing transaction in the reducer (RBF) diff --git a/suite-common/wallet-types/src/account.ts b/suite-common/wallet-types/src/account.ts index ec329037bc3..2cfb211a96e 100644 --- a/suite-common/wallet-types/src/account.ts +++ b/suite-common/wallet-types/src/account.ts @@ -1,12 +1,12 @@ -import { AccountType, BackendType, Bip43Path, NetworkSymbol } from '@suite-common/wallet-config'; import { AccountEntityKeys } from '@suite-common/metadata-types'; -import { AccountInfo, PROTO, StaticSessionId, TokenInfo } from '@trezor/connect'; +import { AccountType, BackendType, Bip43Path, NetworkSymbol } from '@suite-common/wallet-config'; import { AddressAlias, ContractInfo, StakingPool, } from '@trezor/blockchain-link-types/src/blockbook-api'; import { SolanaStakingAccount } from '@trezor/blockchain-link-types/src/solana'; +import { AccountInfo, PROTO, StaticSessionId, TokenInfo } from '@trezor/connect'; export type MetadataItem = string; export type XpubAddress = string; diff --git a/suite-common/wallet-types/src/backend.ts b/suite-common/wallet-types/src/backend.ts index e5891988cef..60b38b69f51 100644 --- a/suite-common/wallet-types/src/backend.ts +++ b/suite-common/wallet-types/src/backend.ts @@ -1,4 +1,4 @@ -import { Explorer, NetworkSymbol, BackendType } from '@suite-common/wallet-config'; +import { BackendType, Explorer, NetworkSymbol } from '@suite-common/wallet-config'; import { TimerId } from '@trezor/type-utils'; /** diff --git a/suite-common/wallet-types/src/discovery.ts b/suite-common/wallet-types/src/discovery.ts index 3eb08a2d7cf..02717761756 100644 --- a/suite-common/wallet-types/src/discovery.ts +++ b/suite-common/wallet-types/src/discovery.ts @@ -1,8 +1,8 @@ -import { ObjectValues } from '@trezor/type-utils'; -import { DiscoveryStatus } from '@suite-common/wallet-constants'; import { AccountType, Bip43Path, NetworkSymbol } from '@suite-common/wallet-config'; -import { Deferred } from '@trezor/utils'; +import { DiscoveryStatus } from '@suite-common/wallet-constants'; import { StaticSessionId } from '@trezor/connect'; +import { ObjectValues } from '@trezor/type-utils'; +import { Deferred } from '@trezor/utils'; import { Account, AccountBackendSpecific } from './account'; diff --git a/suite-common/wallet-types/src/fiatRates.ts b/suite-common/wallet-types/src/fiatRates.ts index f9b5ea56caf..b400b0d177b 100644 --- a/suite-common/wallet-types/src/fiatRates.ts +++ b/suite-common/wallet-types/src/fiatRates.ts @@ -1,6 +1,6 @@ -import type { FiatRatesBySymbol } from '@trezor/connect'; -import { NetworkSymbol } from '@suite-common/wallet-config'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { NetworkSymbol } from '@suite-common/wallet-config'; +import type { FiatRatesBySymbol } from '@trezor/connect'; import { TokenAddress } from './account'; diff --git a/suite-common/wallet-types/src/selectedAccount.ts b/suite-common/wallet-types/src/selectedAccount.ts index 1756f9392ed..1d035129426 100644 --- a/suite-common/wallet-types/src/selectedAccount.ts +++ b/suite-common/wallet-types/src/selectedAccount.ts @@ -1,7 +1,7 @@ import { Network } from '@suite-common/wallet-config'; -import { Discovery } from './discovery'; import { Account, WalletParams } from './account'; +import { Discovery } from './discovery'; // 100% view // // Account loaders diff --git a/suite-common/wallet-types/src/settings.ts b/suite-common/wallet-types/src/settings.ts index 6e9e32604de..487eaf4d0eb 100644 --- a/suite-common/wallet-types/src/settings.ts +++ b/suite-common/wallet-types/src/settings.ts @@ -1,6 +1,6 @@ +import { FiatCurrencyCode } from '@suite-common/suite-config'; import { NetworkSymbol } from '@suite-common/wallet-config'; import { FeeLevel, PROTO } from '@trezor/connect'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; export const AddressDisplayOptions = { ORIGINAL: 'original', diff --git a/suite-common/wallet-types/src/transaction.ts b/suite-common/wallet-types/src/transaction.ts index 845be27bcd2..e1ae2bd78ca 100644 --- a/suite-common/wallet-types/src/transaction.ts +++ b/suite-common/wallet-types/src/transaction.ts @@ -1,20 +1,20 @@ +import { TranslationKey } from '@suite-common/intl-types'; +import { Network, NetworkSymbol } from '@suite-common/wallet-config'; import { + AccountAddress, AccountTransaction, AccountUtxo, - AccountAddress, - FeeLevel, - TokenInfo, ComposeOutput, - PrecomposeResultError as PrecomposedTransactionConnectResponseError, - PrecomposeResultNonFinal as PrecomposedTransactionConnectResponseNonFinal, - PrecomposeResultFinal as PrecomposedTransactionConnectResponseFinal, + FeeLevel, PrecomposedTransactionErrorCardano as PrecomposedTransactionCardanoConnectResponseError, - PrecomposedTransactionNonFinalCardano as PrecomposedTransactionCardanoConnectResponseNonFinal, PrecomposedTransactionFinalCardano as PrecomposedTransactionCardanoConnectResponseFinal, + PrecomposedTransactionNonFinalCardano as PrecomposedTransactionCardanoConnectResponseNonFinal, + PrecomposeResultError as PrecomposedTransactionConnectResponseError, + PrecomposeResultFinal as PrecomposedTransactionConnectResponseFinal, + PrecomposeResultNonFinal as PrecomposedTransactionConnectResponseNonFinal, StaticSessionId, + TokenInfo, } from '@trezor/connect'; -import { Network, NetworkSymbol } from '@suite-common/wallet-config'; -import { TranslationKey } from '@suite-common/intl-types'; import { RequiredKey } from '@trezor/type-utils'; import { Account } from './account'; diff --git a/suite-common/wallet-utils/src/__fixtures__/accountUtils.ts b/suite-common/wallet-utils/src/__fixtures__/accountUtils.ts index 35762f1eec9..f1e627e8a4c 100644 --- a/suite-common/wallet-utils/src/__fixtures__/accountUtils.ts +++ b/suite-common/wallet-utils/src/__fixtures__/accountUtils.ts @@ -1,10 +1,10 @@ +import { TranslationKey } from '@suite-common/intl-types'; import { testMocks } from '@suite-common/test-utils'; import type { Bip43Path, Bip43PathTemplate, NetworkSymbolExtended, } from '@suite-common/wallet-config'; -import { TranslationKey } from '@suite-common/intl-types'; import { ACCOUNTS } from './accounts'; diff --git a/suite-common/wallet-utils/src/__fixtures__/transactionUtils.ts b/suite-common/wallet-utils/src/__fixtures__/transactionUtils.ts index a889c5fd33f..7e0323f82b2 100644 --- a/suite-common/wallet-utils/src/__fixtures__/transactionUtils.ts +++ b/suite-common/wallet-utils/src/__fixtures__/transactionUtils.ts @@ -1,7 +1,7 @@ import { testMocks } from '@suite-common/test-utils'; import { WalletAccountTransaction } from '@suite-common/wallet-types'; -import { AccountTransaction } from '@trezor/connect'; import { TokenTransfer, TransferType } from '@trezor/blockchain-link-types'; +import { AccountTransaction } from '@trezor/connect'; import { TXS } from './transactions'; diff --git a/suite-common/wallet-utils/src/__tests__/accountUtils.test.ts b/suite-common/wallet-utils/src/__tests__/accountUtils.test.ts index 1d903883751..487a444a6e4 100644 --- a/suite-common/wallet-utils/src/__tests__/accountUtils.test.ts +++ b/suite-common/wallet-utils/src/__tests__/accountUtils.test.ts @@ -1,30 +1,30 @@ -import { Account } from '@suite-common/wallet-types'; import { testMocks } from '@suite-common/test-utils'; +import { Account } from '@suite-common/wallet-types'; +import * as fixtures from '../__fixtures__/accountUtils'; import { accountSearchFn, + enhanceAddresses, findAccountDevice, formatNetworkAmount, getAccountIdentifier, getAccountKey, getBip43Type, - substituteBip43Path, getFiatValue, getFirstFreshAddress, + getNetworkAccountFeatures, getTitleForCoinjoinAccount, getUtxoFromSignedTransaction, - getNetworkAccountFeatures, + getUtxoOutpoint, hasNetworkFeatures, isTestnet, networkAmountToSmallestUnit, parseBIP44Path, - sortByCoin, - getUtxoOutpoint, readUtxoOutpoint, sortByBIP44AddressIndex, - enhanceAddresses, + sortByCoin, + substituteBip43Path, } from '../accountUtils'; -import * as fixtures from '../__fixtures__/accountUtils'; const { getSuiteDevice, getWalletAccount } = testMocks; diff --git a/suite-common/wallet-utils/src/__tests__/cardanoUtils.test.ts b/suite-common/wallet-utils/src/__tests__/cardanoUtils.test.ts index 4c49ced7707..1b4a869d8dc 100644 --- a/suite-common/wallet-utils/src/__tests__/cardanoUtils.test.ts +++ b/suite-common/wallet-utils/src/__tests__/cardanoUtils.test.ts @@ -1,25 +1,25 @@ import { CARDANO, PROTO } from '@trezor/connect'; +import * as fixtures from '../__fixtures__/cardanoUtils'; import { + formatMaxOutputAmount, + getAddressParameters, getAddressType, getDelegationCertificates, - getVotingCertificates, + getDerivationType, getNetworkId, getProtocolMagic, getShortFingerprint, getStakePoolForDelegation, - parseAsset, getStakingPath, - transformUserOutputs, - isCardanoTx, + getUnusedChangeAddress, + getVotingCertificates, isCardanoExternalOutput, + isCardanoTx, isPoolOverSaturated, - formatMaxOutputAmount, - getUnusedChangeAddress, - getAddressParameters, - getDerivationType, + parseAsset, + transformUserOutputs, } from '../cardanoUtils'; -import * as fixtures from '../__fixtures__/cardanoUtils'; describe('cardano utils', () => { let dateSpy: any; diff --git a/suite-common/wallet-utils/src/__tests__/ethereumStakingUtils.test.ts b/suite-common/wallet-utils/src/__tests__/ethereumStakingUtils.test.ts index 8a6d464da27..635883b3c94 100644 --- a/suite-common/wallet-utils/src/__tests__/ethereumStakingUtils.test.ts +++ b/suite-common/wallet-utils/src/__tests__/ethereumStakingUtils.test.ts @@ -1,17 +1,17 @@ import { Account } from '@suite-common/wallet-types'; -import { - getAccountAutocompoundBalance, - getEthAccountTotalStakingBalance, - getAccountEverstakeStakingPool, - getUnstakeAmountByEthereumDataHex, -} from '../ethereumStakingUtils'; import { getAccountAutocompoundBalanceFixtures, getAccountEverstakeStakingPoolFixtures, getEthAccountTotalStakingBalanceFixtures, getUnstakeAmountByEthereumDataHexFixtures, } from '../__fixtures__/ethereumStakingUtils'; +import { + getAccountAutocompoundBalance, + getAccountEverstakeStakingPool, + getEthAccountTotalStakingBalance, + getUnstakeAmountByEthereumDataHex, +} from '../ethereumStakingUtils'; describe('getAccountEverstakeStakingPool', () => { getAccountEverstakeStakingPoolFixtures.forEach(({ description, account, expected }) => { diff --git a/suite-common/wallet-utils/src/__tests__/filterReceiveAccounts.test.ts b/suite-common/wallet-utils/src/__tests__/filterReceiveAccounts.test.ts index afae0fd64a1..2d4ecb79c65 100644 --- a/suite-common/wallet-utils/src/__tests__/filterReceiveAccounts.test.ts +++ b/suite-common/wallet-utils/src/__tests__/filterReceiveAccounts.test.ts @@ -2,7 +2,7 @@ import { testMocks } from '@suite-common/test-utils'; import { NetworkSymbol } from '@suite-common/wallet-config'; import { Account } from '@suite-common/wallet-types'; -import { isDebugOnlyAccountType, filterReceiveAccounts } from '../filterReceiveAccounts'; +import { filterReceiveAccounts, isDebugOnlyAccountType } from '../filterReceiveAccounts'; const { getSuiteDevice, getWalletAccount } = testMocks; diff --git a/suite-common/wallet-utils/src/__tests__/getMyInputsFromTransaction.test.ts b/suite-common/wallet-utils/src/__tests__/getMyInputsFromTransaction.test.ts index 31f09b6c370..d367627b08f 100644 --- a/suite-common/wallet-utils/src/__tests__/getMyInputsFromTransaction.test.ts +++ b/suite-common/wallet-utils/src/__tests__/getMyInputsFromTransaction.test.ts @@ -1,6 +1,6 @@ import { - getMyInputsFromTransaction, GetMyInputsFromTransactionParams, + getMyInputsFromTransaction, } from '../getMyInputsFromTransaction'; describe(getMyInputsFromTransaction.name, () => { diff --git a/suite-common/wallet-utils/src/__tests__/sendFormUtils.test.ts b/suite-common/wallet-utils/src/__tests__/sendFormUtils.test.ts index e6c1e5e2e1a..f93ed5802f4 100644 --- a/suite-common/wallet-utils/src/__tests__/sendFormUtils.test.ts +++ b/suite-common/wallet-utils/src/__tests__/sendFormUtils.test.ts @@ -1,5 +1,5 @@ -import { networks } from '@suite-common/wallet-config'; import { testMocks } from '@suite-common/test-utils'; +import { networks } from '@suite-common/wallet-config'; import * as fixtures from '../__fixtures__/sendFormUtils'; import { getUtxoOutpoint } from '../accountUtils'; diff --git a/suite-common/wallet-utils/src/__tests__/transactionUtils.test.ts b/suite-common/wallet-utils/src/__tests__/transactionUtils.test.ts index f512caa950d..96cbcc974d4 100644 --- a/suite-common/wallet-utils/src/__tests__/transactionUtils.test.ts +++ b/suite-common/wallet-utils/src/__tests__/transactionUtils.test.ts @@ -1,24 +1,24 @@ -import { WalletAccountTransaction } from '@suite-common/wallet-types'; import { testMocks } from '@suite-common/test-utils'; +import { WalletAccountTransaction } from '@suite-common/wallet-types'; -import * as fixtures from '../__fixtures__/transactionUtils'; import stMock from '../__fixtures__/searchTransactions.json'; +import * as fixtures from '../__fixtures__/transactionUtils'; import { + MonthKey, advancedSearchTransactions, analyzeTransactions, enhanceTransaction, findChainedTransactions, + generateTransactionMonthKey, getAccountTransactions, getRbfParams, - groupTransactionsByDate, + getTransactionWithLowestNonce, groupJointTransactions, + groupTokensTransactionsByContractAddress, + groupTransactionsByDate, isPending, parseTransactionDateKey, parseTransactionMonthKey, - MonthKey, - generateTransactionMonthKey, - groupTokensTransactionsByContractAddress, - getTransactionWithLowestNonce, } from '../transactionUtils'; const { getWalletTransaction } = testMocks; diff --git a/suite-common/wallet-utils/src/accountUtils.ts b/suite-common/wallet-utils/src/accountUtils.ts index dfed6c14785..0322fea259d 100644 --- a/suite-common/wallet-utils/src/accountUtils.ts +++ b/suite-common/wallet-utils/src/accountUtils.ts @@ -1,52 +1,52 @@ -import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber'; -import { - AccountInfo, - AccountAddresses, - AccountAddress, - AccountTransaction, - AccountUtxo, - PrecomposedTransactionFinalCardano, - TokenTransfer, - TokenInfo, - DeviceState, - StaticSessionId, -} from '@trezor/connect'; -import { arrayDistinct, bufferUtils } from '@trezor/utils'; +import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { TrezorDevice } from '@suite-common/suite-types'; import { - type NetworkFeature, - type NetworkSymbol, - type NetworkType, - networks, type AccountType, type Bip43Path, type Bip43PathTemplate, - getNetwork, + type NetworkFeature, + type NetworkSymbol, type NetworkSymbolExtended, - networkSymbolCollection, + type NetworkType, + getNetwork, getNetworkDisplaySymbol, + networkSymbolCollection, + networks, } from '@suite-common/wallet-config'; import { Account, Discovery, + GeneralPrecomposedTransactionFinal, PrecomposedTransactionFinal, + RatesByKey, ReceiveInfo, TokenAddress, - GeneralPrecomposedTransactionFinal, - RatesByKey, } from '@suite-common/wallet-types'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; -import { TrezorDevice } from '@suite-common/suite-types'; +import { formatTokenSymbol } from '@trezor/blockchain-link-utils'; +import { + AccountAddress, + AccountAddresses, + AccountInfo, + AccountTransaction, + AccountUtxo, + DeviceState, + PrecomposedTransactionFinalCardano, + StaticSessionId, + TokenInfo, + TokenTransfer, +} from '@trezor/connect'; import { HELP_CENTER_ADDRESSES_URL, HELP_CENTER_COINJOIN_URL, HELP_CENTER_TAPROOT_URL, } from '@trezor/urls'; -import { formatTokenSymbol } from '@trezor/blockchain-link-utils'; +import { arrayDistinct, bufferUtils } from '@trezor/utils'; +import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber'; import { toFiatCurrency } from './fiatConverterUtils'; import { getFiatRateKey } from './fiatRatesUtils'; -import { isRbfTransaction } from './transactionUtils'; import { getAccountTotalStakingBalance } from './stakingUtils'; +import { isRbfTransaction } from './transactionUtils'; export const isUtxoBased = (account: Account) => account.networkType === 'bitcoin' || account.networkType === 'cardano'; diff --git a/suite-common/wallet-utils/src/backendUtils.ts b/suite-common/wallet-utils/src/backendUtils.ts index 16ccec6bd39..13fbe8b199c 100644 --- a/suite-common/wallet-utils/src/backendUtils.ts +++ b/suite-common/wallet-utils/src/backendUtils.ts @@ -1,16 +1,16 @@ -import { parseElectrumUrl } from '@trezor/utils'; -import type { - CustomBackend, - BlockchainNetworks, - BackendSettings, - Account, -} from '@suite-common/wallet-types'; import { - TREZOR_CONNECT_BACKENDS, BackendType, NetworkSymbol, + TREZOR_CONNECT_BACKENDS, getNetworkType, } from '@suite-common/wallet-config'; +import type { + Account, + BackendSettings, + BlockchainNetworks, + CustomBackend, +} from '@suite-common/wallet-types'; +import { parseElectrumUrl } from '@trezor/utils'; export const getDefaultBackendType = (symbol: NetworkSymbol) => { if (symbol === 'ada' || symbol === 'tada') { diff --git a/suite-common/wallet-utils/src/cardanoUtils.ts b/suite-common/wallet-utils/src/cardanoUtils.ts index cf9e96f0424..04117bad787 100644 --- a/suite-common/wallet-utils/src/cardanoUtils.ts +++ b/suite-common/wallet-utils/src/cardanoUtils.ts @@ -1,14 +1,14 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; +import { AccountType } from '@suite-common/wallet-config'; import { Account, Output, + PoolsResponse, PrecomposedTransactionFinal, PrecomposedTransactionFinalCardano, - PoolsResponse, StakePool, } from '@suite-common/wallet-types'; import { CARDANO, CardanoCertificate, CardanoOutput, PROTO } from '@trezor/connect'; -import { AccountType } from '@suite-common/wallet-config'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { amountToSmallestUnit, diff --git a/suite-common/wallet-utils/src/ethereumStakingUtils.ts b/suite-common/wallet-utils/src/ethereumStakingUtils.ts index 425bac1b589..de77b444bc4 100644 --- a/suite-common/wallet-utils/src/ethereumStakingUtils.ts +++ b/suite-common/wallet-utils/src/ethereumStakingUtils.ts @@ -1,15 +1,15 @@ import { fromWei, hexToNumberString } from 'web3-utils'; +import { NetworkSymbol, getNetworkFeatures } from '@suite-common/wallet-config'; import { Account, - StakingPoolExtended, StakeType, - supportedNetworkSymbols, + StakingPoolExtended, SupportedEthereumNetworkSymbol, + supportedNetworkSymbols, } from '@suite-common/wallet-types'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; -import { NetworkSymbol, getNetworkFeatures } from '@suite-common/wallet-config'; import { isArrayMember } from '@trezor/utils'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; export const getEverstakePool = (account?: Account) => { if (account?.networkType !== 'ethereum') { diff --git a/suite-common/wallet-utils/src/fiatRatesUtils.ts b/suite-common/wallet-utils/src/fiatRatesUtils.ts index 014e0283987..72dbd1e6f89 100644 --- a/suite-common/wallet-utils/src/fiatRatesUtils.ts +++ b/suite-common/wallet-utils/src/fiatRatesUtils.ts @@ -1,15 +1,15 @@ -import { NetworkSymbol } from '@suite-common/wallet-config'; +import { getFiatRatesForTimestamps } from '@suite-common/fiat-services'; import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { NetworkSymbol } from '@suite-common/wallet-config'; import { - TokenAddress, FiatRateKey, + RatesByTimestamps, TickerId, + TickerResult, Timestamp, - RatesByTimestamps, + TokenAddress, WalletAccountTransaction, - TickerResult, } from '@suite-common/wallet-types'; -import { getFiatRatesForTimestamps } from '@suite-common/fiat-services'; const ONE_HOUR_IN_SECONDS = 60 * 60; diff --git a/suite-common/wallet-utils/src/filterReceiveAccounts.ts b/suite-common/wallet-utils/src/filterReceiveAccounts.ts index 7013953e102..54960b50599 100644 --- a/suite-common/wallet-utils/src/filterReceiveAccounts.ts +++ b/suite-common/wallet-utils/src/filterReceiveAccounts.ts @@ -1,4 +1,4 @@ -import { AccountType, getNetwork, NetworkSymbol } from '@suite-common/wallet-config'; +import { AccountType, NetworkSymbol, getNetwork } from '@suite-common/wallet-config'; import { Account } from '@suite-common/wallet-types'; import { StaticSessionId } from '@trezor/connect'; diff --git a/suite-common/wallet-utils/src/getMyInputsFromTransaction.ts b/suite-common/wallet-utils/src/getMyInputsFromTransaction.ts index 7d40ca7e547..64498125662 100644 --- a/suite-common/wallet-utils/src/getMyInputsFromTransaction.ts +++ b/suite-common/wallet-utils/src/getMyInputsFromTransaction.ts @@ -1,5 +1,5 @@ -import { AccountTransaction } from '@trezor/connect'; import { Account } from '@suite-common/wallet-types'; +import { AccountTransaction } from '@trezor/connect'; export type GetMyInputsFromTransactionParams = { account: Pick; diff --git a/suite-common/wallet-utils/src/localizeNumberUtils.ts b/suite-common/wallet-utils/src/localizeNumberUtils.ts index fff6fd3caae..c9b13ea7a4c 100644 --- a/suite-common/wallet-utils/src/localizeNumberUtils.ts +++ b/suite-common/wallet-utils/src/localizeNumberUtils.ts @@ -1,5 +1,5 @@ -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { getLocaleSeparators } from '@trezor/utils'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; export const localizeNumber = ( value: number | string | BigNumber, diff --git a/suite-common/wallet-utils/src/reviewTransactionUtils.ts b/suite-common/wallet-utils/src/reviewTransactionUtils.ts index 1e2e5776ea5..7f64a192299 100644 --- a/suite-common/wallet-utils/src/reviewTransactionUtils.ts +++ b/suite-common/wallet-utils/src/reviewTransactionUtils.ts @@ -1,17 +1,17 @@ import { fromWei, toWei } from 'web3-utils'; -import { CardanoOutput } from '@trezor/connect'; -import { getFirmwareVersion } from '@trezor/device-utils'; -import { versionUtils } from '@trezor/utils'; +import { TrezorDevice } from '@suite-common/suite-types'; import { Account, FormState, GeneralPrecomposedTransactionFinal, + ReviewOutput, ReviewOutputState, StakeFormState, - ReviewOutput, } from '@suite-common/wallet-types'; -import { TrezorDevice } from '@suite-common/suite-types'; +import { CardanoOutput } from '@trezor/connect'; +import { getFirmwareVersion } from '@trezor/device-utils'; +import { versionUtils } from '@trezor/utils'; import { getShortFingerprint, isCardanoTx } from './cardanoUtils'; import { isRbfTransaction } from './transactionUtils'; diff --git a/suite-common/wallet-utils/src/sendFormUtils.ts b/suite-common/wallet-utils/src/sendFormUtils.ts index 4c962eb749c..9377b05b5bd 100644 --- a/suite-common/wallet-utils/src/sendFormUtils.ts +++ b/suite-common/wallet-utils/src/sendFormUtils.ts @@ -9,10 +9,8 @@ import { import { fromWei, numberToHex, padLeft, toWei } from 'web3-utils'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; import { fiatCurrencies } from '@suite-common/suite-config'; import { Network, NetworkType } from '@suite-common/wallet-config'; -import { EthereumTransaction, TokenInfo, ComposeOutput, PROTO } from '@trezor/connect'; import { COMPOSE_ERROR_TYPES, DEFAULT_PAYMENT, @@ -20,20 +18,22 @@ import { ERC20_TRANSFER, } from '@suite-common/wallet-constants'; import type { - FormState, - FeeInfo, - EthTransactionData, - ExternalOutput, - Output, - RbfTransactionParams, Account, + AccountKey, CurrencyOption, + EthTransactionData, ExcludedUtxos, + ExternalOutput, + FeeInfo, + FormState, GeneralPrecomposedTransactionFinal, - AccountKey, - TokenAddress, + Output, + RbfTransactionParams, SendFormDraftKey, + TokenAddress, } from '@suite-common/wallet-types'; +import { ComposeOutput, EthereumTransaction, PROTO, TokenInfo } from '@trezor/connect'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { amountToSmallestUnit, getUtxoOutpoint, networkAmountToSmallestUnit } from './accountUtils'; import { sanitizeHex } from './ethUtils'; diff --git a/suite-common/wallet-utils/src/settingsUtils.ts b/suite-common/wallet-utils/src/settingsUtils.ts index 416793d3f7c..287d6082ae0 100644 --- a/suite-common/wallet-utils/src/settingsUtils.ts +++ b/suite-common/wallet-utils/src/settingsUtils.ts @@ -1,5 +1,5 @@ -import { PROTO } from '@trezor/connect'; import { Account } from '@suite-common/wallet-types'; +import { PROTO } from '@trezor/connect'; import { hasNetworkFeatures } from './accountUtils'; diff --git a/suite-common/wallet-utils/src/solanaStakingUtils.ts b/suite-common/wallet-utils/src/solanaStakingUtils.ts index 9123c17b1b4..36a7aeb8ae7 100644 --- a/suite-common/wallet-utils/src/solanaStakingUtils.ts +++ b/suite-common/wallet-utils/src/solanaStakingUtils.ts @@ -1,15 +1,15 @@ -import { Solana, SolDelegation, SolNetwork, StakeAccount, StakeState } from '@everstake/wallet-sdk'; +import { SolDelegation, SolNetwork, Solana, StakeAccount, StakeState } from '@everstake/wallet-sdk'; -import { getNetworkFeatures, NetworkSymbol } from '@suite-common/wallet-config'; -import { BigNumber, isArrayMember } from '@trezor/utils'; -import { SolanaStakingAccount } from '@trezor/blockchain-link-types/src/solana'; +import { NetworkSymbol, getNetworkFeatures } from '@suite-common/wallet-config'; +import { SOLANA_EPOCH_DAYS } from '@suite-common/wallet-constants'; import { Account, - supportedSolanaNetworkSymbols, SupportedSolanaNetworkSymbols, + supportedSolanaNetworkSymbols, } from '@suite-common/wallet-types'; +import { SolanaStakingAccount } from '@trezor/blockchain-link-types/src/solana'; import { PartialRecord } from '@trezor/type-utils'; -import { SOLANA_EPOCH_DAYS } from '@suite-common/wallet-constants'; +import { BigNumber, isArrayMember } from '@trezor/utils'; import { formatNetworkAmount } from './accountUtils'; diff --git a/suite-common/wallet-utils/src/stakingUtils.ts b/suite-common/wallet-utils/src/stakingUtils.ts index 4d1322f1e2e..4fa5068a6c5 100644 --- a/suite-common/wallet-utils/src/stakingUtils.ts +++ b/suite-common/wallet-utils/src/stakingUtils.ts @@ -1,4 +1,3 @@ -import { Account, StakingPoolExtended } from '@suite-common/wallet-types'; import { NetworkSymbol } from '@suite-common/wallet-config'; import { MAX_ETH_AMOUNT_FOR_STAKING, @@ -10,6 +9,7 @@ import { MIN_SOL_BALANCE_FOR_STAKING, MIN_SOL_FOR_WITHDRAWALS, } from '@suite-common/wallet-constants'; +import { Account, StakingPoolExtended } from '@suite-common/wallet-types'; import { getAccountEverstakeStakingPool, diff --git a/suite-common/wallet-utils/src/transactionUtils.ts b/suite-common/wallet-utils/src/transactionUtils.ts index 6a3b1966aee..ce90d255b05 100644 --- a/suite-common/wallet-utils/src/transactionUtils.ts +++ b/suite-common/wallet-utils/src/transactionUtils.ts @@ -1,36 +1,36 @@ -import { fromWei, toWei } from 'web3-utils'; import { addDays, startOfMonth } from 'date-fns'; +import { fromWei, toWei } from 'web3-utils'; -import { BigNumber } from '@trezor/utils/src/bigNumber'; +import { AccountLabels } from '@suite-common/metadata-types'; +import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { SignOperator } from '@suite-common/suite-types'; import { Account, - RbfTransactionParams, - WalletAccountTransaction, + AccountKey, ChainedTransactions, + GeneralPrecomposedTransactionFinal, PrecomposedTransactionFinal, - AccountKey, - TokenAddress, + PrecomposedTransactionFinalRbf, RatesByTimestamps, + RbfTransactionParams, Timestamp, - GeneralPrecomposedTransactionFinal, - PrecomposedTransactionFinalRbf, + TokenAddress, + WalletAccountTransaction, } from '@suite-common/wallet-types'; import { AccountAddress, AccountTransaction, - TokenTransfer, InternalTransfer, TokenInfo, + TokenTransfer, } from '@trezor/connect'; -import { SignOperator } from '@suite-common/suite-types'; import { arrayPartition } from '@trezor/utils'; -import { AccountLabels } from '@suite-common/metadata-types'; -import { FiatCurrencyCode } from '@suite-common/suite-config'; +import { BigNumber } from '@trezor/utils/src/bigNumber'; import { formatAmount, formatNetworkAmount, isTokenMatchesSearch } from './accountUtils'; -import { toFiatCurrency } from '../src/fiatConverterUtils'; import { getFiatRateKey, roundTimestampToNearestPastHour } from './fiatRatesUtils'; import { getMyInputsFromTransaction } from './getMyInputsFromTransaction'; +import { toFiatCurrency } from '../src/fiatConverterUtils'; export const sortByBlockHeight = (a: { blockHeight?: number }, b: { blockHeight?: number }) => { // if both are missing the blockHeight don't change their order diff --git a/suite-common/wallet-utils/src/validationUtils.ts b/suite-common/wallet-utils/src/validationUtils.ts index 428d4952366..0bca0f9deca 100644 --- a/suite-common/wallet-utils/src/validationUtils.ts +++ b/suite-common/wallet-utils/src/validationUtils.ts @@ -2,9 +2,9 @@ import { UseFormSetValue } from 'react-hook-form'; import { toChecksumAddress } from 'web3-utils'; -import addressValidator from '@trezor/address-validator'; import { getTestnetSymbols } from '@suite-common/wallet-config'; import { Account } from '@suite-common/wallet-types'; +import addressValidator from '@trezor/address-validator'; import { AccountInfo } from '@trezor/blockchain-link-types'; const getNetworkType = (symbol: Account['symbol']) => {