Skip to content

Commit

Permalink
chore(coinmarket): replaced relative imports by absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
adderpositive authored and tomasklim committed Oct 8, 2024
1 parent b00a6ae commit b0d3302
Show file tree
Hide file tree
Showing 47 changed files with 106 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { testMocks } from '@suite-common/test-utils';
import { MODAL } from 'src/actions/suite/constants';
import { COINMARKET_BUY, COINMARKET_EXCHANGE } from 'src/actions/wallet/constants';
import { AddressDisplayOptions } from '@suite-common/wallet-types';

import { BTC_ACCOUNT, ETH_ACCOUNT, XRP_ACCOUNT } from './accounts';
import {
BTC_ACCOUNT,
ETH_ACCOUNT,
XRP_ACCOUNT,
} from 'src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/accounts';

const { getSuiteDevice } = testMocks;
const UNAVAILABLE_DEVICE = getSuiteDevice({ available: false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { configureStore } from 'src/support/tests/configureStore';

import { coinmarketReducer, ComposedTransactionInfo } from 'src/reducers/wallet/coinmarketReducer';
import selectedAccountReducer from 'src/reducers/wallet/selectedAccountReducer';
import * as coinmarketCommonActions from '../coinmarketCommonActions';
import { DEFAULT_STORE } from '../__fixtures__/coinmarketCommonActions/store';
import {
VERIFY_BUY_ADDRESS_FIXTURES,
VERIFY_EXCHANGE_ADDRESS_FIXTURES,
} from '../__fixtures__/coinmarketCommonActions/verifyAddress';
import { transactionsReducer, accountsReducer } from 'src/reducers/wallet';
import { State as DeviceState } from '@suite-common/wallet-core';
import { SuiteState } from 'src/reducers/suite/suiteReducer';
import type { DeepPartial } from '@trezor/type-utils';
import { DEFAULT_STORE } from 'src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/store';
import {
VERIFY_BUY_ADDRESS_FIXTURES,
VERIFY_EXCHANGE_ADDRESS_FIXTURES,
} from 'src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/verifyAddress';
import * as coinmarketCommonActions from 'src/actions/wallet/coinmarket/coinmarketCommonActions';

interface InitialState {
device?: DeepPartial<DeviceState>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import { Account } from 'src/types/wallet';
import { ComposedTransactionInfo } from 'src/reducers/wallet/coinmarketReducer';
import { submitRequestForm as envSubmitRequestForm } from 'src/utils/suite/env';
import * as formDraftActions from 'src/actions/wallet/formDraftActions';
import { COINMARKET_BUY, COINMARKET_EXCHANGE, COINMARKET_COMMON } from '../constants';
import { AddressDisplayOptions } from '@suite-common/wallet-types';
import { selectAddressDisplayType } from 'src/reducers/suite/suiteReducer';
import { CryptoId } from 'invity-api';
import {
COINMARKET_BUY,
COINMARKET_COMMON,
COINMARKET_EXCHANGE,
} from 'src/actions/wallet/constants';

export type CoinmarketCommonAction =
| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from 'src/utils/wallet/coinmarket/buyUtils';
import { useFormDraft } from 'src/hooks/wallet/useFormDraft';
import { AmountLimits } from 'src/types/wallet/coinmarketCommonTypes';
import { useCoinmarketBuyFormDefaultValues } from './useCoinmarketBuyFormDefaultValues';
import { CoinmarketTradeBuyType, UseCoinmarketFormProps } from 'src/types/coinmarket/coinmarket';
import {
addIdsToQuotes,
Expand All @@ -24,10 +23,6 @@ import {
CoinmarketBuyFormContextProps,
CoinmarketBuyFormProps,
} from 'src/types/coinmarket/coinmarketForm';
import {
getFilteredSuccessQuotes,
useCoinmarketCommonOffers,
} from '../offers/useCoinmarketCommonOffers';
import * as coinmarketInfoActions from 'src/actions/wallet/coinmarketInfoActions';
import * as coinmarketCommonActions from 'src/actions/wallet/coinmarket/coinmarketCommonActions';
import * as coinmarketBuyActions from 'src/actions/wallet/coinmarketBuyActions';
Expand All @@ -49,6 +44,11 @@ import { useCoinmarketModalCrypto } from 'src/hooks/wallet/coinmarket/form/commo
import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo';
import { networks } from '@suite-common/wallet-config';
import { analytics, EventType } from '@trezor/suite-analytics';
import {
getFilteredSuccessQuotes,
useCoinmarketCommonOffers,
} from 'src/hooks/wallet/coinmarket/offers/useCoinmarketCommonOffers';
import { useCoinmarketBuyFormDefaultValues } from 'src/hooks/wallet/coinmarket/form/useCoinmarketBuyFormDefaultValues';

export const useCoinmarketBuyForm = ({
selectedAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ import { useCoinmarketLoadData } from 'src/hooks/wallet/coinmarket/useCoinmarket
import { useCoinmarketComposeTransaction } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketComposeTransaction';
import { useCoinmarketFormActions } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketFormActions';
import { useCoinmarketCurrencySwitcher } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketCurrencySwitcher';
import { useCoinmarketFiatValues } from './common/useCoinmarketFiatValues';
import { CoinmarketExchangeStepType } from 'src/types/coinmarket/coinmarketOffers';
import { useCoinmarketModalCrypto } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketModalCrypto';
import { networks } from '@suite-common/wallet-config';
import { useCoinmarketAccount } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketAccount';
import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo';
import { analytics, EventType } from '@trezor/suite-analytics';
import { useCoinmarketFiatValues } from 'src/hooks/wallet/coinmarket/form/common/useCoinmarketFiatValues';

export const useCoinmarketExchangeForm = ({
selectedAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
CoinmarketUseDetailOutputProps,
CoinmarketUseDetailProps,
} from 'src/types/coinmarket/coinmarketDetail';
import { useCoinmarketWatchTrade } from './useCoinmarketWatchTrade';
import { Trade, TradeBuy } from 'src/types/wallet/coinmarketCommonTypes';
import {
CoinmarketGetDetailDataProps,
Expand All @@ -16,8 +15,9 @@ import {
CoinmarketTradeMapProps,
CoinmarketTradeType,
} from 'src/types/coinmarket/coinmarket';
import { useServerEnvironment } from './useServerEnviroment';
import { useCoinmarketLoadData } from 'src/hooks/wallet/coinmarket/useCoinmarketLoadData';
import { useServerEnvironment } from 'src/hooks/wallet/coinmarket/useServerEnviroment';
import { useCoinmarketWatchTrade } from 'src/hooks/wallet/coinmarket/useCoinmarketWatchTrade';

const isBuyTrade = (trade: Trade): trade is TradeBuy => trade.tradeType === 'buy';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useTimeoutFn, useUnmount } from 'react-use';
import { Trade, TradeType } from 'src/types/wallet/coinmarketCommonTypes';
import { useFormDraft } from '../useFormDraft';
import invityAPI from 'src/services/suite/invityAPI';
import { saveTrade as saveBuyTrade } from 'src/actions/wallet/coinmarketBuyActions';
import { saveTrade as saveExchangeTrade } from 'src/actions/wallet/coinmarketExchangeActions';
Expand All @@ -21,6 +20,7 @@ import {
CoinmarketUseWatchTradeProps,
CoinmarketWatchTradeProps,
} from 'src/types/coinmarket/coinmarket';
import { useFormDraft } from 'src/hooks/wallet/useFormDraft';

export const tradeFinalStatuses: Record<TradeType, CoinmarketTradeStatusType[]> = {
buy: ['SUCCESS', 'ERROR', 'BLOCKED'] satisfies BuyTradeFinalStatus[],
Expand Down
3 changes: 1 addition & 2 deletions packages/suite/src/types/coinmarket/coinmarketDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import type { CoinmarketTradeCommonProps } from 'src/reducers/wallet/coinmarketR
import type { Account } from 'src/types/wallet';
import type { TradeType } from 'src/types/wallet/coinmarketCommonTypes';
import type { SelectedAccountLoaded } from '@suite-common/wallet-types';

import {
CoinmarketTradeInfoMapProps,
CoinmarketTradeMapProps,
CoinmarketTradeType,
} from './coinmarket';
} from 'src/types/coinmarket/coinmarket';

export interface CoinmarketDetailContextValues<T extends CoinmarketTradeType>
extends CoinmarketTradeCommonProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/suite/src/types/coinmarket/coinmarketOffers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CryptoId } from 'invity-api';
import { CoinmarketTradeType } from './coinmarket';
import { CoinmarketTradeType } from 'src/types/coinmarket/coinmarket';
import {
CoinmarketBuyFormContextProps,
CoinmarketExchangeFormContextProps,
CoinmarketSellFormContextProps,
} from './coinmarketForm';
} from 'src/types/coinmarket/coinmarketForm';

export type CoinmarketBuyAddressOptionsType = {
address?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import * as fixtures from '../__fixtures__/buyUtils';
import { getAmountLimits, createQuoteLink, getStatusMessage, createTxLink } from '../buyUtils';
import * as fixtures from 'src/utils/wallet/coinmarket/__fixtures__/buyUtils';
import {
getAmountLimits,
createQuoteLink,
getStatusMessage,
createTxLink,
} from 'src/utils/wallet/coinmarket/buyUtils';

const {
QUOTE_REQUEST_FIAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
coinmarketGetAmountLabels,
coinmarketGetAccountLabel,
testnetToProdCryptoId,
} from '../coinmarketUtils';
} from 'src/utils/wallet/coinmarket/coinmarketUtils';
import {
FIXTURE_ACCOUNTS,
accountBtc,
accountEth,
coinDefinitions,
} from '../__fixtures__/coinmarketUtils';
} from 'src/utils/wallet/coinmarket/__fixtures__/coinmarketUtils';
import * as BUY_FIXTURE from 'src/utils/wallet/coinmarket/__fixtures__/buyUtils';
import * as SELL_FIXTURE from 'src/utils/wallet/coinmarket/__fixtures__/sellUtils';
import * as EXCHANGE_FIXTURE from 'src/utils/wallet/coinmarket/__fixtures__/exchangeUtils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CryptoId } from 'invity-api';
import * as fixtures from '../__fixtures__/exchangeUtils';
import * as fixtures from 'src/utils/wallet/coinmarket/__fixtures__/exchangeUtils';
import {
coinmarketGetExchangeReceiveCryptoId,
getAmountLimits,
getStatusMessage,
getSuccessQuotesOrdered,
isQuoteError,
} from '../exchangeUtils';
} from 'src/utils/wallet/coinmarket/exchangeUtils';

const { MIN_MAX_QUOTES_OK, MIN_MAX_QUOTES_LOW, MIN_MAX_QUOTES_CANNOT_TRADE } = fixtures;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as fixtures from '../__fixtures__/sellUtils';
import { getStatusMessage, formatIban, getAmountLimits, createQuoteLink } from '../sellUtils';
import {
getStatusMessage,
formatIban,
getAmountLimits,
createQuoteLink,
} from 'src/utils/wallet/coinmarket/sellUtils';
import { Account } from 'src/types/wallet';
import { ComposedTransactionInfo } from 'src/reducers/wallet/coinmarketReducer';
import * as fixtures from 'src/utils/wallet/coinmarket/__fixtures__/sellUtils';

const {
QUOTE_REQUEST_FIAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
} from '@trezor/components';
import { UseCoinmarketProps } from 'src/types/coinmarket/coinmarket';
import { withSelectedAccountLoaded } from 'src/components/wallet';
import { CoinmarketLayout } from '../common/CoinmarketLayoutNew/CoinmarketLayout';
import styled from 'styled-components';
import { borders, palette, spacings, spacingsPx } from '@trezor/theme';
import { Translation, TrezorLink } from 'src/components/suite';
import { COINMARKET_DOWNLOAD_INVITY_APP_URL } from '@trezor/urls';
import { useSelector } from 'src/hooks/suite';
import { variables } from '@trezor/components/src/config';
import { CoinmarketLayout } from 'src/views/wallet/coinmarket/common/CoinmarketLayoutNew/CoinmarketLayout';

const IconWrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { withSelectedAccountLoaded } from 'src/components/wallet';
import { UseCoinmarketProps } from 'src/types/coinmarket/coinmarket';
import { CoinmarketLayout } from '../common/CoinmarketLayoutNew/CoinmarketLayout';
import { CoinmarketFormLayout } from '../common/CoinmarketForm/CoinmarketFormLayout';
import { useCoinmarketBuyForm } from 'src/hooks/wallet/coinmarket/form/useCoinmarketBuyForm';
import { CoinmarketFormContext } from 'src/hooks/wallet/coinmarket/form/useCoinmarketCommonForm';
import { CoinmarketFormLayout } from 'src/views/wallet/coinmarket/common/CoinmarketForm/CoinmarketFormLayout';
import { CoinmarketLayout } from 'src/views/wallet/coinmarket/common/CoinmarketLayoutNew/CoinmarketLayout';

const CoinmarketBuyComponent = (props: UseCoinmarketProps) => {
const coinmarketBuyContextValues = useCoinmarketBuyForm(props);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styled from 'styled-components';

import { Button, variables, Link, Image } from '@trezor/components';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common';
import { useDispatch } from 'src/hooks/suite';
import { Account } from 'src/types/wallet';
import { Translation } from 'src/components/suite/Translation';
import { goto } from 'src/actions/suite/routerActions';
import { spacingsPx } from '@trezor/theme';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common/CoinmarketTransactionId';

const Wrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import styled from 'styled-components';

import { Button, variables, Link, Image } from '@trezor/components';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common';
import { useDispatch } from 'src/hooks/suite';
import { Account } from 'src/types/wallet';
import { Translation } from 'src/components/suite/Translation';
import { ExchangeProviderInfo } from 'invity-api';
import { goto } from 'src/actions/suite/routerActions';
import { spacingsPx } from '@trezor/theme';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common/CoinmarketTransactionId';

const Wrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styled from 'styled-components';

import { Button, variables, Link, Image } from '@trezor/components';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common';
import { useDispatch } from 'src/hooks/suite';
import { Account } from 'src/types/wallet';
import { Translation } from 'src/components/suite/Translation';
import { goto } from 'src/actions/suite/routerActions';
import { spacingsPx } from '@trezor/theme';
import { CoinmarketTransactionId } from 'src/views/wallet/coinmarket/common/CoinmarketTransactionId';

const Wrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import styled, { useTheme } from 'styled-components';
import { CoinmarketFiatAmount } from '../CoinmarketFiatAmount';
import { getCryptoQuoteAmountProps } from 'src/utils/wallet/coinmarket/coinmarketTypingUtils';
import { FormattedCryptoAmount } from 'src/components/suite';
import { useCoinmarketInfo } from '../../../../../hooks/wallet/coinmarket/useCoinmarketInfo';
import { CoinmarketTradeDetailType } from 'src/types/coinmarket/coinmarket';
import { spacingsPx } from '@trezor/theme';
import { useCoinmarketFormContext } from 'src/hooks/wallet/coinmarket/form/useCoinmarketCommonForm';
Expand All @@ -13,6 +11,8 @@ import {
} from 'src/hooks/wallet/coinmarket/offers/useCoinmarketCommonOffers';
import { CryptoId } from 'invity-api';
import { Icon } from '@trezor/components';
import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo';
import { CoinmarketFiatAmount } from 'src/views/wallet/coinmarket/common/CoinmarketFiatAmount';

const Arrow = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled, { useTheme } from 'styled-components';
import { Badge, Button, Card, Text } from '@trezor/components';
import { Translation } from 'src/components/suite';
import { spacings, spacingsPx } from '@trezor/theme';
import { CoinmarketUtilsProvider } from '../CoinmarketUtils/CoinmarketUtilsProvider';
import { SCREEN_QUERY } from '@trezor/components/src/config/variables';
import {
isCoinmarketBuyOffers,
Expand All @@ -17,13 +16,14 @@ import {
import { getTagAndInfoNote } from 'src/utils/wallet/coinmarket/coinmarketUtils';
import { SellFiatTrade } from 'invity-api';
import { CoinmarketFormContextValues } from 'src/types/coinmarket/coinmarketForm';
import { CoinmarketFeaturedOffersAmounts } from './CoinmarketFeaturedOffersAmounts';
import { CoinmarketFeaturedOffersPaymentInfo } from './CoinmarketFeaturedOffersPaymentInfo';
import {
CoinmarketTradeDetailBuySellType,
CoinmarketTradeDetailType,
CoinmarketTradeType,
} from 'src/types/coinmarket/coinmarket';
import { CoinmarketFeaturedOffersAmounts } from 'src/views/wallet/coinmarket/common/CoinmarketFeaturedOffers/CoinmarketFeaturedOffersAmounts';
import { CoinmarketUtilsProvider } from 'src/views/wallet/coinmarket/common/CoinmarketUtils/CoinmarketUtilsProvider';
import { CoinmarketFeaturedOffersPaymentInfo } from 'src/views/wallet/coinmarket/common/CoinmarketFeaturedOffers/CoinmarketFeaturedOffersPaymentInfo';

const Offer = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
CoinmarketTradeType,
} from 'src/types/coinmarket/coinmarket';
import { Translation } from 'src/components/suite';
import { CoinmarketPaymentPlainType } from '../CoinmarketPaymentPlainType';
import styled from 'styled-components';
import { spacingsPx } from '@trezor/theme';
import { CoinmarketPaymentPlainType } from 'src/views/wallet/coinmarket/common/CoinmarketPaymentPlainType';

const PaymentInfoWrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useState, useRef } from 'react';
import styled, { css } from 'styled-components';
import { useOnClickOutside } from '@trezor/react-utils';
import { DATA_TOS_INVITY_URL, INVITY_URL } from '@trezor/urls';
import { CoinmarketProvidedByInvity } from './CoinmarketProvidedByInvity';
import { Translation } from 'src/components/suite';
import { borders, spacingsPx, zIndices } from '@trezor/theme';
import { CoinmarketFooterLogoWrapper } from 'src/views/wallet/coinmarket';
import { CoinmarketProvidedByInvity } from 'src/views/wallet/coinmarket/common/CoinmarketFooter/CoinmarketProvidedByInvity';

const Wrapper = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Radio } from '@trezor/components';
import { variables } from '@trezor/components/src/config';
import { Translation } from 'src/components/suite';
import { borders, spacingsPx } from '@trezor/theme';
import { CoinmarketFormInputLabel } from './CoinmarketFormInputLabel';
import { CoinmarketExchangeFormProps, RateType } from 'src/types/coinmarket/coinmarketForm';
import { UseFormSetValue } from 'react-hook-form';
import { SCREEN_QUERY } from '@trezor/components/src/config/variables';
Expand All @@ -12,6 +11,7 @@ import {
FORM_RATE_FLOATING,
FORM_RATE_TYPE,
} from 'src/constants/wallet/coinmarket/form';
import { CoinmarketFormInputLabel } from 'src/views/wallet/coinmarket/common/CoinmarketForm/CoinmarketFormInput/CoinmarketFormInputLabel';

const RadioItems = styled.div`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import {
} from 'src/utils/wallet/coinmarket/coinmarketUtils';
import { CoinmarketFormOfferFiatAmount } from 'src/views/wallet/coinmarket/common/CoinmarketForm/CoinmarketFormOfferFiatAmount';
import { isCoinmarketExchangeOffers } from 'src/hooks/wallet/coinmarket/offers/useCoinmarketCommonOffers';
import { CoinmarketFormOffersSwitcher } from './CoinmarketFormOffersSwitcher';
import { ExchangeTrade } from 'invity-api';
import { CoinmarketTradeDetailType, CoinmarketTradeType } from 'src/types/coinmarket/coinmarket';
import { CoinmarketFormContextValues } from 'src/types/coinmarket/coinmarketForm';
import { FORM_EXCHANGE_DEX, FORM_EXCHANGE_TYPE } from 'src/constants/wallet/coinmarket/form';
import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo';
import { CoinmarketFormOffersSwitcher } from 'src/views/wallet/coinmarket/common/CoinmarketForm/CoinmarketFormOffersSwitcher';

const CoinmarketFormOfferHeader = styled.div`
display: flex;
Expand Down
Loading

0 comments on commit b0d3302

Please sign in to comment.