Skip to content

Commit

Permalink
chore(coinmarket): replaced default exports by unit exports
Browse files Browse the repository at this point in the history
  • Loading branch information
adderpositive authored and tomasklim committed Oct 8, 2024
1 parent 9940828 commit b00a6ae
Show file tree
Hide file tree
Showing 49 changed files with 115 additions and 164 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { configureStore } from 'src/support/tests/configureStore';

import coinmarketReducer from 'src/reducers/wallet/coinmarketReducer';
import { coinmarketReducer } from 'src/reducers/wallet/coinmarketReducer';

import * as coinmarketBuyActions from '../coinmarketBuyActions';
import invityAPI from 'src/services/suite/invityAPI';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { configureStore } from 'src/support/tests/configureStore';

import coinmarketReducer from 'src/reducers/wallet/coinmarketReducer';
import { coinmarketReducer } from 'src/reducers/wallet/coinmarketReducer';

import * as coinmarketExchangeActions from '../coinmarketExchangeActions';
import invityAPI from 'src/services/suite/invityAPI';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account } from 'src/types/wallet';
import coinmarketReducer from 'src/reducers/wallet/coinmarketReducer';
import { coinmarketReducer } from 'src/reducers/wallet/coinmarketReducer';
import selectedAccountReducer from 'src/reducers/wallet/selectedAccountReducer';
import { transactionsReducer } from 'src/reducers/wallet';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { configureStore } from 'src/support/tests/configureStore';

import coinmarketReducer, { ComposedTransactionInfo } from 'src/reducers/wallet/coinmarketReducer';
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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { useCoinmarketInfo } from 'src/hooks/wallet/coinmarket/useCoinmarketInfo
import { networks } from '@suite-common/wallet-config';
import { analytics, EventType } from '@trezor/suite-analytics';

const useCoinmarketBuyForm = ({
export const useCoinmarketBuyForm = ({
selectedAccount,
pageType = 'form',
}: UseCoinmarketFormProps): CoinmarketBuyFormContextProps => {
Expand Down Expand Up @@ -521,5 +521,3 @@ const useCoinmarketBuyForm = ({
setAmountLimits,
};
};

export default useCoinmarketBuyForm;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { configureStore } from 'src/support/tests/configureStore';

import coinmarketReducer, { initialState } from 'src/reducers/wallet/coinmarketReducer';
import { coinmarketReducer, initialState } from 'src/reducers/wallet/coinmarketReducer';
import selectedAccountReducer from 'src/reducers/wallet/selectedAccountReducer';
import coinmarketMiddleware from 'src/middlewares/wallet/coinmarketMiddleware';
import { coinmarketMiddleware } from 'src/middlewares/wallet/coinmarketMiddleware';
import { Action } from 'src/types/suite';
import { COINMARKET_COMMON } from 'src/actions/wallet/constants';
import invityAPI from 'src/services/suite/invityAPI';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as coinmarketSellActions from 'src/actions/wallet/coinmarketSellActions
import { UI } from '@trezor/connect';
import { ROUTER, MODAL } from 'src/actions/suite/constants';

const coinmarketMiddleware =
export const coinmarketMiddleware =
(api: MiddlewareAPI<Dispatch, AppState>) =>
(next: Dispatch) =>
(action: Action): Action => {
Expand Down Expand Up @@ -135,5 +135,3 @@ const coinmarketMiddleware =

return action;
};

export default coinmarketMiddleware;
2 changes: 1 addition & 1 deletion packages/suite/src/middlewares/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { prepareDiscoveryMiddleware } from './discoveryMiddleware';
import storageMiddleware from './storageMiddleware';
import walletMiddleware from './walletMiddleware';
import graphMiddleware from './graphMiddleware';
import coinmarketMiddleware from './coinmarketMiddleware';
import { coinmarketMiddleware } from './coinmarketMiddleware';
import { coinjoinMiddleware } from './coinjoinMiddleware';
import { extraDependencies } from 'src/support/extraDependencies';
import { prepareTokenDefinitionsMiddleware } from '@suite-common/token-definitions';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import reducer, { initialState } from 'src/reducers/wallet/coinmarketReducer';
import { coinmarketReducer, initialState } from 'src/reducers/wallet/coinmarketReducer';
import { TradeBuy, TradeExchange } from 'src/types/wallet/coinmarketCommonTypes';
import { STORAGE } from 'src/actions/suite/constants';
import {
Expand Down Expand Up @@ -27,7 +27,7 @@ import { accounts } from 'src/reducers/wallet/__fixtures__/transactionConstants'
describe('settings reducer', () => {
it('test initial state', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
// @ts-expect-error
type: 'none',
}),
Expand All @@ -36,7 +36,7 @@ describe('settings reducer', () => {

it('STORAGE.LOAD', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: STORAGE.LOAD,
payload: {
coinmarketTrades: initialState.trades,
Expand All @@ -47,7 +47,7 @@ describe('settings reducer', () => {

it('COINMARKET_COMMON.SET_MODAL_ACCOUNT', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_COMMON.SET_MODAL_ACCOUNT,
modalAccount: accounts[0],
}),
Expand All @@ -57,7 +57,7 @@ describe('settings reducer', () => {
});

expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_COMMON.SET_MODAL_ACCOUNT,
modalAccount: undefined,
}),
Expand All @@ -69,7 +69,7 @@ describe('settings reducer', () => {

it('COINMARKET_COMMON.SET_MODAL_CRYPTO_CURRENCY', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_COMMON.SET_MODAL_CRYPTO_CURRENCY,
modalCryptoId: 'ankr' as CryptoId,
}),
Expand All @@ -79,7 +79,7 @@ describe('settings reducer', () => {
});

expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_COMMON.SET_MODAL_CRYPTO_CURRENCY,
modalCryptoId: undefined,
}),
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('settings reducer', () => {
},
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_INFO.SAVE_INFO,
info,
}),
Expand All @@ -131,7 +131,7 @@ describe('settings reducer', () => {
supportedFiatCurrencies: new Set(['usd']),
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_BUY_INFO,
buyInfo,
}),
Expand All @@ -140,7 +140,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.SET_IS_FROM_REDIRECT', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SET_IS_FROM_REDIRECT,
isFromRedirect: true,
} as any),
Expand All @@ -156,7 +156,7 @@ describe('settings reducer', () => {
fiatStringAmount: '1',
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_QUOTE_REQUEST,
request,
}),
Expand All @@ -165,7 +165,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.SAVE_TRANSACTION_DETAIL_ID', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_TRANSACTION_DETAIL_ID,
transactionId: '1234-1234-1234',
}),
Expand All @@ -177,7 +177,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.SAVE_QUOTES', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_QUOTES,
quotes: buyQuotes,
}),
Expand All @@ -189,7 +189,7 @@ describe('settings reducer', () => {

it('COINMARKET_SELL.SELL_QUOTES', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SAVE_QUOTES,
quotes: sellQuotes,
}),
Expand All @@ -201,7 +201,7 @@ describe('settings reducer', () => {

it('COINMARKET_EXCHANGE.EXCHANGE_QUOTES', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.SAVE_QUOTES,
quotes: exchangeQuotes,
}),
Expand All @@ -213,7 +213,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.VERIFY_ADDRESS', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.VERIFY_ADDRESS,
addressVerified: '1abcdef',
}),
Expand All @@ -222,7 +222,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.DISPOSE', () => {
expect(
reducer(
coinmarketReducer(
{ ...initialState, buy: { ...initialState.buy, addressVerified: '1abcdef' } },
{
type: COINMARKET_BUY.DISPOSE,
Expand All @@ -240,7 +240,7 @@ describe('settings reducer', () => {
};

expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_CACHED_ACCOUNT_INFO,
...cachedAccountInfo,
} as any),
Expand All @@ -254,7 +254,7 @@ describe('settings reducer', () => {
sellSymbols: new Set(['USDT@ETH']) as Set<CryptoId>,
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.SAVE_EXCHANGE_INFO,
exchangeInfo,
}),
Expand All @@ -268,7 +268,7 @@ describe('settings reducer', () => {
sendStringAmount: '1',
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.SAVE_QUOTE_REQUEST,
request,
}),
Expand All @@ -280,7 +280,7 @@ describe('settings reducer', () => {

it('COINMARKET_EXCHANGE.VERIFY_ADDRESS', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.VERIFY_ADDRESS,
addressVerified: '2efghi',
}),
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('settings reducer', () => {
};

expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_COMMON.SAVE_TRADE,
...tradeBuy,
}),
Expand All @@ -353,7 +353,7 @@ describe('settings reducer', () => {
});

expect(
reducer(
coinmarketReducer(
{
...initialState,
trades: [tradeExchange, tradeBuy],
Expand All @@ -371,7 +371,7 @@ describe('settings reducer', () => {

it('COINMARKET_SELL.SET_IS_FROM_REDIRECT', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SET_IS_FROM_REDIRECT,
isFromRedirect: true,
}),
Expand All @@ -380,7 +380,7 @@ describe('settings reducer', () => {

it('COINMARKET_SELL.SAVE_TRANSACTION_ID', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SAVE_TRANSACTION_ID,
transactionId: '1234-1234-1234',
}),
Expand All @@ -398,7 +398,7 @@ describe('settings reducer', () => {
cryptoStringAmount: '1',
};
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SAVE_QUOTE_REQUEST,
request,
}),
Expand All @@ -410,7 +410,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.CLEAR_QUOTES', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.CLEAR_QUOTES,
}),
).toEqual({
Expand All @@ -421,7 +421,7 @@ describe('settings reducer', () => {

it('COINMARKET_BUY.SAVE_QUOTE', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_BUY.SAVE_QUOTE,
quote: buyQuotes[0],
}),
Expand All @@ -436,7 +436,7 @@ describe('settings reducer', () => {

it('COINMARKET_SELL.SAVE_QUOTE', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SAVE_QUOTE,
quote: sellQuotes[0],
}),
Expand All @@ -451,7 +451,7 @@ describe('settings reducer', () => {

it('COINMARKET_EXCHANGE.SAVE_QUOTE', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.SAVE_QUOTE,
quote: exchangeQuotes[0],
}),
Expand All @@ -466,7 +466,7 @@ describe('settings reducer', () => {

it('COINMARKET_SELL.SET_COINMARKET_ACCOUNT', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_SELL.SET_COINMARKET_ACCOUNT,
account: accounts[0],
}),
Expand All @@ -481,7 +481,7 @@ describe('settings reducer', () => {

it('COINMARKET_EXCHANGE.SET_COINMARKET_ACCOUNT', () => {
expect(
reducer(undefined, {
coinmarketReducer(undefined, {
type: COINMARKET_EXCHANGE.SET_COINMARKET_ACCOUNT,
account: accounts[0],
}),
Expand Down
4 changes: 1 addition & 3 deletions packages/suite/src/reducers/wallet/coinmarketReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const initialState: State = {
lastLoadedTimestamp: 0,
};

const coinmarketReducer = (
export const coinmarketReducer = (
state: State = initialState,
action: WalletAction | SuiteAction,
): State =>
Expand Down Expand Up @@ -258,5 +258,3 @@ const coinmarketReducer = (
// no default
}
});

export default coinmarketReducer;
2 changes: 1 addition & 1 deletion packages/suite/src/reducers/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import settingsReducer from './settingsReducer';
import graphReducer from './graphReducer';
import selectedAccountReducer from './selectedAccountReducer';
import receiveReducer from './receiveReducer';
import coinmarketReducer from './coinmarketReducer';
import { coinmarketReducer } from './coinmarketReducer';
import accountSearchReducer from './accountSearchReducer';
import formDraftReducer from './formDraftReducer';
import cardanoStakingReducer from './cardanoStakingReducer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@trezor/components';
import { UseCoinmarketProps } from 'src/types/coinmarket/coinmarket';
import { withSelectedAccountLoaded } from 'src/components/wallet';
import CoinmarketLayout from '../common/CoinmarketLayoutNew/CoinmarketLayout';
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';
Expand Down
Loading

0 comments on commit b00a6ae

Please sign in to comment.