@luxexchange/lx 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -14
- package/src/components/CurrencyInputPanel/AmountInputPresets/PresetAmountButton.tsx +1 -1
- package/src/components/CurrencyInputPanel/CurrencyInputPanelBalance.tsx +1 -1
- package/src/components/CurrencyInputPanel/CurrencyInputPanelHeader.tsx +1 -1
- package/src/components/CurrencyInputPanel/hooks/useIndicativeQuoteTextDisplay.ts +1 -1
- package/src/components/CurrencyLogo/TokenLogo.test.tsx +1 -1
- package/src/components/MultichainTokenDetails/MultichainAddressList.test.tsx +1 -1
- package/src/components/TokenSelector/filter.test.ts +1 -1
- package/src/components/TokenSelector/hooks/useLuxTokensOptions.ts +1 -1
- package/src/components/lists/OnchainItemList/processSectionsToRows.test.tsx +1 -1
- package/src/components/modals/WarningModal/types.ts +1 -1
- package/src/components/notifications/iconUtils.ts +1 -1
- package/src/components/reporting/ReportPoolDataModal.tsx +1 -1
- package/src/components/reporting/ReportTokenDataModal.tsx +1 -1
- package/src/components/reporting/ReportTokenIssueModal.tsx +1 -1
- package/src/constants/routing.ts +1 -1
- package/src/dialog-preferences/implementations/createDialogPreferencesService.test.ts +1 -1
- package/src/features/activity/extract/extractRestDEXOrderDetails.ts +1 -1
- package/src/features/activity/utils/remote.ts +1 -1
- package/src/features/chains/evm/info/avalanche.ts +1 -1
- package/src/features/chains/evm/info/blast.ts +1 -1
- package/src/features/chains/evm/info/bnb.ts +1 -1
- package/src/features/chains/evm/info/mainnet.ts +1 -1
- package/src/features/chains/evm/info/monad.ts +1 -1
- package/src/features/chains/evm/info/worldchain.ts +1 -1
- package/src/features/chains/evm/tokens.test.ts +1 -1
- package/src/features/chains/evm/tokens.ts +1 -1
- package/src/features/chains/utils.ts +1 -1
- package/src/features/dataApi/balances/balancesRest.ts +1 -1
- package/src/features/dataApi/balances/utils.ts +1 -1
- package/src/features/dataApi/types.ts +1 -1
- package/src/features/dataApi/utils/buildCurrency.test.ts +1 -1
- package/src/features/dataApi/utils/buildCurrency.ts +1 -1
- package/src/features/fiatOnRamp/PaymentMethodFilter/PaymentMethodFilter.test.tsx +1 -1
- package/src/features/fiatOnRamp/types.ts +1 -1
- package/src/features/gas/hooks/useCancellationGasFeeInfo.test.ts +1 -1
- package/src/features/gas/hooks/useMaxAmountSpend.ts +1 -1
- package/src/features/gas/utils.test.ts +1 -1
- package/src/features/language/formatter.ts +1 -1
- package/src/features/notifications/slice/types.ts +1 -1
- package/src/features/portfolio/portfolioUpdates/fetchOnChainBalances.ts +1 -1
- package/src/features/portfolio/portfolioUpdates/rest/fetchOnChainBalancesRest.test.ts +1 -1
- package/src/features/portfolio/portfolioUpdates/rest/fetchOnChainBalancesRest.ts +1 -1
- package/src/features/portfolio/portfolioUpdates/rest/refetchRestQueriesViaOnchainOverrideVariantSaga.test.ts +1 -1
- package/src/features/providers/FlashbotsRpcClient.test.ts +1 -1
- package/src/features/reporting/reports.ts +1 -1
- package/src/features/search/SearchModal/analytics/analytics.test.ts +1 -1
- package/src/features/settings/hooks.test.ts +2 -2
- package/src/features/tokens/SolanaToken.ts +1 -1
- package/src/features/tokens/getCurrencyAmount.test.ts +1 -1
- package/src/features/tokens/getCurrencyAmount.ts +1 -1
- package/src/features/tokens/stablecoin.ts +1 -1
- package/src/features/tokens/warnings/safetyUtils.test.ts +1 -1
- package/src/features/tokens/warnings/safetyUtils.ts +1 -1
- package/src/features/tokens/warnings/slice/hooks.ts +1 -1
- package/src/features/transactions/TransactionDetails/UserReceiveAmount.tsx +1 -1
- package/src/features/transactions/TransactionDetails/types.ts +1 -1
- package/src/features/transactions/cancel/cancelMultipleOrders.test.ts +1 -1
- package/src/features/transactions/cancel/cancelOrderFactory.test.ts +1 -1
- package/src/features/transactions/components/TransactionModal/TransactionModalContext.tsx +1 -1
- package/src/features/transactions/hooks/useUSDCPrice.ts +1 -1
- package/src/features/transactions/liquidity/steps/generateLPTransactionSteps.ts +1 -1
- package/src/features/transactions/steps/approve.ts +1 -1
- package/src/features/transactions/steps/permit2Transaction.ts +1 -1
- package/src/features/transactions/steps/wrap.ts +1 -1
- package/src/features/transactions/swap/components/MaxSlippageRow/SlippageInfo/SlippageInfoCaption.tsx +1 -1
- package/src/features/transactions/swap/components/MaxSlippageRow/SlippageInfo/useFormatSlippageAmount.ts +1 -1
- package/src/features/transactions/swap/components/PriceImpactRow/usePriceImpact.test.ts +1 -1
- package/src/features/transactions/swap/components/PriceImpactRow/usePriceImpact.ts +1 -1
- package/src/features/transactions/swap/components/SwapFormButton/hooks/useSwapFormButtonHooks.test.ts +1 -1
- package/src/features/transactions/swap/components/SwapFormSettings/settingsConfigurations/slippage/SlippageScreenNative.tsx +1 -1
- package/src/features/transactions/swap/components/UnichainInstantBalanceModal/hooks/receiptFetching/utils.ts +1 -1
- package/src/features/transactions/swap/form/SwapFormScreen/YouReceiveDetails/SwapDetailsRow.tsx +1 -1
- package/src/features/transactions/swap/form/hooks/useOnSelectCurrency.ts +1 -1
- package/src/features/transactions/swap/form/stores/swapFormScreenStore/createSwapFormScreenStore.ts +1 -1
- package/src/features/transactions/swap/form/stores/swapFormScreenStore/useSwapFormScreenCallbacks.test.ts +3 -3
- package/src/features/transactions/swap/hooks/useSwapWarnings/getBalanceWarning.test.ts +2 -2
- package/src/features/transactions/swap/hooks/useSwapWarnings/getFormIncompleteWarning.test.ts +1 -1
- package/src/features/transactions/swap/hooks/useSwapWarnings/getPriceImpactWarning.test.ts +1 -1
- package/src/features/transactions/swap/hooks/useSwapWarnings/getPriceImpactWarning.ts +1 -1
- package/src/features/transactions/swap/hooks/useSwapWarnings/getTokenBlockedWarning.test.ts +1 -1
- package/src/features/transactions/swap/hooks/useSwapWarnings/useSwapWarnings.test.ts +1 -1
- package/src/features/transactions/swap/hooks/useTrade/logging.ts +1 -1
- package/src/features/transactions/swap/hooks/useTrade/parseQuoteCurrencies.ts +1 -1
- package/src/features/transactions/swap/hooks/useTrade.ts +1 -1
- package/src/features/transactions/swap/plan/planSaga.test.ts +1 -1
- package/src/features/transactions/swap/review/hooks/useTokenApprovalInfo.test.ts +1 -1
- package/src/features/transactions/swap/review/services/swapTxAndGasInfoService/utils.test.ts +3 -3
- package/src/features/transactions/swap/services/tradeService/transformations/transformQuoteToTrade.ts +1 -1
- package/src/features/transactions/swap/types/derivedSwapInfo.ts +1 -1
- package/src/features/transactions/swap/types/getTradingApiSwapFee.test.ts +1 -1
- package/src/features/transactions/swap/types/getTradingApiSwapFee.ts +1 -1
- package/src/features/transactions/swap/types/solana.test.ts +1 -1
- package/src/features/transactions/swap/types/solana.ts +1 -1
- package/src/features/transactions/swap/types/trade.test.ts +1 -1
- package/src/features/transactions/swap/types/wrapCallback.ts +1 -1
- package/src/features/transactions/swap/utils/asset.ts +1 -1
- package/src/features/transactions/swap/utils/format.ts +1 -1
- package/src/features/transactions/swap/utils/formatPriceImpact.test.ts +1 -1
- package/src/features/transactions/swap/utils/formatPriceImpact.ts +1 -1
- package/src/features/transactions/swap/utils/generateSwapTransactionSteps.test.ts +2 -2
- package/src/features/transactions/swap/utils/getExactOutputWillFail.test.ts +1 -1
- package/src/features/transactions/swap/utils/getExactOutputWillFail.ts +1 -1
- package/src/features/transactions/swap/utils/getPriceImpact.ts +1 -1
- package/src/features/transactions/swap/utils/getSwapFeeUsd.ts +1 -1
- package/src/features/transactions/swap/utils/getTradeAmounts.ts +1 -1
- package/src/features/transactions/swap/utils/trade.test.ts +2 -2
- package/src/features/transactions/swap/utils/tradingApi.ts +3 -3
- package/src/features/transactions/swap/utils/wrap.ts +1 -1
- package/src/features/transactions/types/baseDerivedInfo.ts +1 -1
- package/src/features/unitags/UnitagInfoModal.tsx +1 -1
- package/src/i18n/utils.test.ts +1 -1
- package/src/test/fixtures/gql/assets/tokens.ts +1 -1
- package/src/test/fixtures/lib/sdk.ts +1 -1
- package/src/test/fixtures/transactions/swap.ts +2 -2
- package/src/test/fixtures/wallet/currencies.ts +1 -1
- package/src/test/fixtures/wallet/transactions/fixtures.ts +1 -1
- package/src/test/mocks/locale.ts +1 -1
- package/src/utils/approvals.test.ts +1 -1
- package/src/utils/currency.ts +1 -1
- package/src/utils/isWSOL.test.ts +1 -1
- package/src/utils/isWSOL.ts +1 -1
- package/src/utils/routingDiagram/routingProviders/jupiterRoutingProvider.test.ts +1 -1
- package/src/utils/routingDiagram/routingProviders/jupiterRoutingProvider.ts +1 -1
- package/src/utils/routingDiagram/routingProviders/luxRoutingProvider.test.ts +3 -3
- package/src/utils/routingDiagram/types.ts +1 -1
- package/src/utils/search/doesTokenMatchSearchTerm.test.ts +1 -1
- package/src/utils/search/doesTokenMatchSearchTerm.ts +1 -1
- package/.depcheckrc +0 -26
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -79
- package/LLM.md +0 -145
- package/babel.config.js +0 -39
- package/env.d.ts +0 -15
- package/eslint_rules/i18n.js +0 -44
- package/eslint_rules/no-redux-modals.js +0 -54
- package/jest-package-mocks.js +0 -38
- package/openapitools.json +0 -7
- package/tsconfig.eslint.json +0 -6
- package/vitest-package-mocks.ts +0 -76
- package/vitest-setup.ts +0 -246
- package/vitest.config.ts +0 -86
package/.eslintrc.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const biomeSupportedRules = require('@luxfi/eslint-config/biome-supported')
|
|
2
|
-
const { reactNative: reactNativeImports } = require('@luxfi/eslint-config/restrictedImports')
|
|
3
|
-
const rulesDirPlugin = require('eslint-plugin-rulesdir')
|
|
4
|
-
rulesDirPlugin.RULES_DIR = 'eslint_rules'
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
root: true,
|
|
8
|
-
extends: ['@luxfi/eslint-config/native', '@luxfi/eslint-config/webPlatform'],
|
|
9
|
-
plugins: ['rulesdir'],
|
|
10
|
-
ignorePatterns: [
|
|
11
|
-
'node_modules',
|
|
12
|
-
'.turbo',
|
|
13
|
-
'.eslintrc.js',
|
|
14
|
-
'codegen.ts',
|
|
15
|
-
'.nx',
|
|
16
|
-
'vitest-setup.ts',
|
|
17
|
-
'vitest.config.ts',
|
|
18
|
-
'vitest-package-mocks.ts',
|
|
19
|
-
],
|
|
20
|
-
parserOptions: {
|
|
21
|
-
project: 'tsconfig.eslint.json',
|
|
22
|
-
tsconfigRootDir: __dirname,
|
|
23
|
-
ecmaFeatures: {
|
|
24
|
-
jsx: true,
|
|
25
|
-
},
|
|
26
|
-
ecmaVersion: 2018,
|
|
27
|
-
sourceType: 'module',
|
|
28
|
-
},
|
|
29
|
-
rules: {
|
|
30
|
-
'rulesdir/i18n': 'error',
|
|
31
|
-
},
|
|
32
|
-
overrides: [
|
|
33
|
-
{
|
|
34
|
-
files: ['**'],
|
|
35
|
-
rules: {
|
|
36
|
-
// Disable all ESLint rules that have been migrated to Biome
|
|
37
|
-
...biomeSupportedRules,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
files: ['**/*.{ts,tsx}'],
|
|
42
|
-
excludedFiles: ['**/*.native.*', '**/*.ios.*', '**/*.android.*'],
|
|
43
|
-
rules: {
|
|
44
|
-
'@typescript-eslint/no-restricted-imports': ['error', reactNativeImports],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
files: [
|
|
49
|
-
'src/index.ts',
|
|
50
|
-
'src/features/telemetry/constants/index.ts',
|
|
51
|
-
'src/features/telemetry/constants/trace/index.ts',
|
|
52
|
-
'src/i18n/index.ts',
|
|
53
|
-
'src/state/index.ts',
|
|
54
|
-
'src/test/**',
|
|
55
|
-
],
|
|
56
|
-
rules: {
|
|
57
|
-
'check-file/no-index': 'off',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
files: ['*.ts', '*.tsx'],
|
|
62
|
-
rules: {
|
|
63
|
-
'no-relative-import-paths/no-relative-import-paths': [
|
|
64
|
-
'error',
|
|
65
|
-
{
|
|
66
|
-
allowSameFolder: false,
|
|
67
|
-
prefix: 'lx',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
files: ['**/features/gating/flags.ts'],
|
|
74
|
-
rules: {
|
|
75
|
-
'local-rules/custom-map-sort': 'error',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
}
|
package/LLM.md
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
This is the `packages/lx` directory within the Lux Exchange monorepo. It contains shared TypeScript code used across all Lux frontend applications (Web, Mobile, and Extension). The package provides core business logic, components, utilities, and data layers that enable cross-platform consistency.
|
|
8
|
-
|
|
9
|
-
## Key Commands
|
|
10
|
-
|
|
11
|
-
### Development Commands
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# Build the package
|
|
15
|
-
bun build
|
|
16
|
-
# Run tests in watch mode
|
|
17
|
-
# Run tests in watch mode
|
|
18
|
-
bun run test --watch # Using Jest's watch flag
|
|
19
|
-
# Type checking
|
|
20
|
-
bun typecheck
|
|
21
|
-
|
|
22
|
-
# Linting
|
|
23
|
-
bun lint
|
|
24
|
-
bun lint:fix
|
|
25
|
-
|
|
26
|
-
# Testing
|
|
27
|
-
bun run test
|
|
28
|
-
bun run test --testPathPattern=ComponentName # Run specific test
|
|
29
|
-
bun snapshots # Update Jest snapshots
|
|
30
|
-
|
|
31
|
-
# GraphQL code generation
|
|
32
|
-
bun graphql:generate
|
|
33
|
-
|
|
34
|
-
# Contract types generation
|
|
35
|
-
bun contracts
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Monorepo Commands (run from root)
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# Install dependencies
|
|
42
|
-
bun install
|
|
43
|
-
|
|
44
|
-
# Run development checks
|
|
45
|
-
bun local:check
|
|
46
|
-
|
|
47
|
-
# Initial setup for local development
|
|
48
|
-
bun lfg
|
|
49
|
-
|
|
50
|
-
# Run specific app
|
|
51
|
-
bun mobile ios
|
|
52
|
-
bun web start
|
|
53
|
-
bun extension start
|
|
54
|
-
|
|
55
|
-
# Run all checks
|
|
56
|
-
bun g:run-all-checks
|
|
57
|
-
|
|
58
|
-
# Type check changed files only
|
|
59
|
-
bun g:typecheck:changed
|
|
60
|
-
|
|
61
|
-
# Lint changed files only
|
|
62
|
-
bun g:lint:changed
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Architecture Overview
|
|
66
|
-
|
|
67
|
-
### Package Structure
|
|
68
|
-
|
|
69
|
-
- **`src/abis/`** - Smart contract ABIs and TypeChain-generated types
|
|
70
|
-
- **`src/components/`** - Shared React components (platform-agnostic)
|
|
71
|
-
- **`src/features/`** - Feature modules organized by domain (auth, transactions, tokens, etc.)
|
|
72
|
-
- **`src/data/`** - Data layer with Apollo GraphQL and REST API clients
|
|
73
|
-
- **`src/hooks/`** - Shared React hooks
|
|
74
|
-
- **`src/state/`** - Redux state management with RTK
|
|
75
|
-
- **`src/utils/`** - Utility functions
|
|
76
|
-
|
|
77
|
-
### Platform Support
|
|
78
|
-
|
|
79
|
-
This package supports multiple platforms through conditional file extensions:
|
|
80
|
-
|
|
81
|
-
- `.native.ts` - React Native specific (mobile)
|
|
82
|
-
- `.web.ts` - Web-specific implementations
|
|
83
|
-
- `.ts` - Shared cross-platform code
|
|
84
|
-
|
|
85
|
-
### Key Technologies
|
|
86
|
-
|
|
87
|
-
- **TypeScript** with strict typing
|
|
88
|
-
- **Redux Toolkit** for state management
|
|
89
|
-
- **Apollo Client** for GraphQL
|
|
90
|
-
- **React Query (TanStack Query)** for server state
|
|
91
|
-
- **Ethers.js & Viem** for blockchain interactions
|
|
92
|
-
- **i18next** for internationalization (30+ languages)
|
|
93
|
-
|
|
94
|
-
### Testing Strategy
|
|
95
|
-
|
|
96
|
-
- Jest with React Native preset
|
|
97
|
-
- Test files use `.test.ts(x)` pattern
|
|
98
|
-
- Snapshot testing for components
|
|
99
|
-
- Run single test: `bun run test --testPathPattern=ComponentName`
|
|
100
|
-
|
|
101
|
-
### Code Generation
|
|
102
|
-
|
|
103
|
-
The package uses several code generation tools:
|
|
104
|
-
|
|
105
|
-
- **GraphQL Codegen** - Generates TypeScript types from GraphQL schema
|
|
106
|
-
- **TypeChain** - Generates TypeScript types from smart contract ABIs
|
|
107
|
-
- **Trading API Codegen** - Generates types from OpenAPI spec
|
|
108
|
-
|
|
109
|
-
## Important Development Notes
|
|
110
|
-
|
|
111
|
-
1. **Multi-platform Support**: Always consider platform differences when modifying code. Use platform-specific files when necessary.
|
|
112
|
-
|
|
113
|
-
2. **Type Safety**: This package enforces strict TypeScript. Always run `bun typecheck` before committing.
|
|
114
|
-
|
|
115
|
-
3. **State Management**: Redux state is shared across platforms. Changes to reducers affect all apps.
|
|
116
|
-
|
|
117
|
-
4. **Generated Files**: Don't manually edit files in:
|
|
118
|
-
- `src/abis/types/` (run `bun contracts`)
|
|
119
|
-
- `src/data/graphql/__generated__/` (run `bun graphql:generate`)
|
|
120
|
-
- `src/data/tradingApi/__generated__/` (run `bun tradingapi:generate`)
|
|
121
|
-
|
|
122
|
-
5. **Testing**: When adding new components or features, include tests. The package uses Jest with React Native preset.
|
|
123
|
-
|
|
124
|
-
6. **Internationalization**: All user-facing strings must use i18next. Use the `t` function from `react-i18next`.
|
|
125
|
-
|
|
126
|
-
7. **Analytics**: Use the centralized analytics service for tracking events across platforms.
|
|
127
|
-
|
|
128
|
-
## Workspace Integration
|
|
129
|
-
|
|
130
|
-
This package is consumed by:
|
|
131
|
-
|
|
132
|
-
- `apps/web` - Uniswap web interface
|
|
133
|
-
- `apps/mobile` - React Native mobile app
|
|
134
|
-
- `apps/extension` - Browser extension
|
|
135
|
-
|
|
136
|
-
It depends on workspace packages:
|
|
137
|
-
|
|
138
|
-
- `packages/ui` - Tamagui-based UI components
|
|
139
|
-
- `packages/utilities` - Pure utility functions
|
|
140
|
-
|
|
141
|
-
## Performance Considerations
|
|
142
|
-
|
|
143
|
-
1. **Bundle Size**: This is a shared package - be mindful of dependencies that might bloat app bundles.
|
|
144
|
-
2. **Platform-Specific Code**: Use conditional imports and platform extensions to avoid including unnecessary code.
|
|
145
|
-
3. **Memoization**: Use React.memo and useMemo appropriately for expensive computations.
|
package/babel.config.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const { NODE_ENV } = process.env
|
|
2
|
-
|
|
3
|
-
const inProduction = NODE_ENV === 'production'
|
|
4
|
-
|
|
5
|
-
module.exports = function (api) {
|
|
6
|
-
api.cache.using(() => process.env.NODE_ENV)
|
|
7
|
-
|
|
8
|
-
let plugins = inProduction ? ['transform-remove-console'] : []
|
|
9
|
-
|
|
10
|
-
plugins = [
|
|
11
|
-
...plugins,
|
|
12
|
-
[
|
|
13
|
-
'module:react-native-dotenv',
|
|
14
|
-
{
|
|
15
|
-
// ideally use envName here to add a mobile namespace but this doesn't work when sharing with dotenv-webpack
|
|
16
|
-
moduleName: 'react-native-dotenv',
|
|
17
|
-
path: '../../.env.defaults', // must use this path so this file can be shared with web since dotenv-webpack is less flexible
|
|
18
|
-
safe: true,
|
|
19
|
-
allowUndefined: false,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
|
|
23
|
-
'transform-inline-environment-variables',
|
|
24
|
-
// TypeScript compiles this, but in production builds, metro doesn't use tsc
|
|
25
|
-
'@babel/plugin-proposal-logical-assignment-operators',
|
|
26
|
-
// metro doesn't like these
|
|
27
|
-
'@babel/plugin-proposal-numeric-separator',
|
|
28
|
-
// https://github.com/software-mansion/react-native-reanimated/issues/3364#issuecomment-1268591867
|
|
29
|
-
'@babel/plugin-proposal-export-namespace-from',
|
|
30
|
-
// 'react-native-reanimated/plugin' must be listed last
|
|
31
|
-
// https://arc.net/l/quote/plrvpkad
|
|
32
|
-
'react-native-reanimated/plugin',
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
presets: ['babel-preset-expo'],
|
|
37
|
-
plugins,
|
|
38
|
-
}
|
|
39
|
-
}
|
package/env.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/noNamespace: required to define process.env type */
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
namespace NodeJS {
|
|
5
|
-
// All process.env values used by this package should be listed here
|
|
6
|
-
interface ProcessEnv {
|
|
7
|
-
NODE_ENV?: 'development' | 'production' | 'test'
|
|
8
|
-
REACT_APP_VERSION_TAG?: string
|
|
9
|
-
REACT_APP_WEB_BUILD_TYPE?: string
|
|
10
|
-
VERSION?: string
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {}
|
package/eslint_rules/i18n.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const { ESLintUtils } = require('@typescript-eslint/utils')
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
meta: {
|
|
5
|
-
type: 'problem',
|
|
6
|
-
docs: {
|
|
7
|
-
description: 'Enforce proper i18next translation interpolation usage',
|
|
8
|
-
category: 'Best Practices',
|
|
9
|
-
recommended: true,
|
|
10
|
-
},
|
|
11
|
-
schema: [],
|
|
12
|
-
messages: {
|
|
13
|
-
cannotBeUndefined:
|
|
14
|
-
'i18n "{{translationKey}}" cannot have an undefined interpolation. Either provide a fallback or do not render.' +
|
|
15
|
-
'\n {{argType}}',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
create(context) {
|
|
20
|
-
const services = ESLintUtils.getParserServices(context)
|
|
21
|
-
const checker = services.program.getTypeChecker()
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
CallExpression(node) {
|
|
25
|
-
if (node.callee.type === 'Identifier' && node.callee.name === 't' && node.arguments.length > 1) {
|
|
26
|
-
const firstArg = node.arguments[0]
|
|
27
|
-
const secondArg = node.arguments[1]
|
|
28
|
-
if (secondArg.type === 'ObjectExpression') {
|
|
29
|
-
const tsNode = services.esTreeNodeToTSNodeMap.get(secondArg)
|
|
30
|
-
const type = checker.getTypeAtLocation(tsNode)
|
|
31
|
-
const typeString = checker.typeToString(type)
|
|
32
|
-
if (typeString.includes('undefined')) {
|
|
33
|
-
context.report({
|
|
34
|
-
node: node.callee,
|
|
35
|
-
messageId: 'cannotBeUndefined',
|
|
36
|
-
data: { argType: typeString, translationKey: firstArg.value },
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
meta: {
|
|
3
|
-
type: 'problem',
|
|
4
|
-
docs: {
|
|
5
|
-
description: 'Prevent adding new modal types to the deprecated modalSlice',
|
|
6
|
-
category: 'Best Practices',
|
|
7
|
-
recommended: true,
|
|
8
|
-
},
|
|
9
|
-
schema: [],
|
|
10
|
-
messages: {
|
|
11
|
-
noNewModals:
|
|
12
|
-
'Adding new modal types to modalSlice is deprecated. Please use React Navigation for new modals instead. See apps/mobile/src/app/navigation/navigation.tsx for examples.',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
create(context) {
|
|
17
|
-
if (!context.getFilename().endsWith('modalSlice.ts')) {
|
|
18
|
-
return {}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const existingModalTypes = new Set([
|
|
22
|
-
'BiometricsModalParams',
|
|
23
|
-
'EditProfileSettingsModalParams',
|
|
24
|
-
'EditLabelSettingsModalParams',
|
|
25
|
-
'ExploreModalParams',
|
|
26
|
-
'FiatCurrencySelectorParams',
|
|
27
|
-
'FiatOnRampAggregatorModalParams',
|
|
28
|
-
'LanguageSelectorModalParams',
|
|
29
|
-
'SettingsAppearanceModalParams',
|
|
30
|
-
'PortfolioBalanceModalParams',
|
|
31
|
-
'ManageWalletsModalParams',
|
|
32
|
-
'WalletConnectModalParams',
|
|
33
|
-
'ConnectionsDappListModalParams',
|
|
34
|
-
'SwapModalParams',
|
|
35
|
-
'SendModalParams',
|
|
36
|
-
'PermissionsModalParams',
|
|
37
|
-
'OpenModalParams',
|
|
38
|
-
'CloseModalParams',
|
|
39
|
-
])
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
'TSTypeAliasDeclaration, TSInterfaceDeclaration'(node) {
|
|
43
|
-
const typeName = node.id.name
|
|
44
|
-
|
|
45
|
-
if (typeName.endsWith('ModalParams') && !existingModalTypes.has(typeName)) {
|
|
46
|
-
context.report({
|
|
47
|
-
node: node.id,
|
|
48
|
-
messageId: 'noNewModals',
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
}
|
package/jest-package-mocks.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common Jest mocks for packages that depend on lux.
|
|
3
|
-
* Note: The lux package itself has migrated to Vitest (see vitest-package-mocks.ts).
|
|
4
|
-
* This file is kept for other packages (e.g., mobile, extension, wallet) that still use Jest.
|
|
5
|
-
*
|
|
6
|
-
* Notes:
|
|
7
|
-
* * Try not to add test specific mocks here.
|
|
8
|
-
* * Be wary of the import order.
|
|
9
|
-
* * mocks can be overridden
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import '@shopify/react-native-skia/jestSetup'
|
|
13
|
-
import mockRNLocalize from 'react-native-localize/mock'
|
|
14
|
-
import { mockLocalizationContext } from 'lux/src/test/mocks/locale'
|
|
15
|
-
import { mockSharedPersistQueryClientProvider } from 'lux/src/test/mocks/mockSharedPersistQueryClientProvider'
|
|
16
|
-
|
|
17
|
-
jest.mock('react-native-localize', () => mockRNLocalize)
|
|
18
|
-
jest.mock('lux/src/features/language/LocalizationContext', () => mockLocalizationContext({}))
|
|
19
|
-
jest.mock('lux/src/data/apiClients/SharedPersistQueryClientProvider', () => mockSharedPersistQueryClientProvider)
|
|
20
|
-
|
|
21
|
-
jest.mock('utilities/src/device/uniqueId', () => {
|
|
22
|
-
return jest.requireActual('lux/src/test/mocks/uniqueId')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
jest.mock('lux/src/data/getVersionHeader', () => {
|
|
26
|
-
return jest.requireActual('lux/src/data/getVersionHeader.web')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
jest.mock('@universe/gating', () => {
|
|
30
|
-
const actual = jest.requireActual('@universe/gating')
|
|
31
|
-
return {
|
|
32
|
-
...actual,
|
|
33
|
-
useClientAsyncInit: jest.fn(() => ({
|
|
34
|
-
client: null,
|
|
35
|
-
isLoading: true,
|
|
36
|
-
})),
|
|
37
|
-
}
|
|
38
|
-
})
|
package/openapitools.json
DELETED
package/tsconfig.eslint.json
DELETED
package/vitest-package-mocks.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common mocks for this package. This file is intended to be imported in the vitest-setup.ts file of the package.
|
|
3
|
-
*
|
|
4
|
-
* Notes:
|
|
5
|
-
* * Try not to add test specific mocks here.
|
|
6
|
-
* * Be wary of the import order.
|
|
7
|
-
* * mocks can be overridden
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { vi } from 'vitest'
|
|
11
|
-
import { mockLocalizationContext } from './src/test/mocks/locale'
|
|
12
|
-
import { mockSharedPersistQueryClientProvider } from './src/test/mocks/mockSharedPersistQueryClientProvider'
|
|
13
|
-
|
|
14
|
-
// Custom react-native-localize mock (the package's mock uses jest.fn() which isn't available)
|
|
15
|
-
const mockRNLocalize = {
|
|
16
|
-
findBestLanguageTag: () => ({ languageTag: 'en-US', isRTL: false }),
|
|
17
|
-
getLocales: () => [{ countryCode: 'US', languageTag: 'en-US', languageCode: 'en', isRTL: false }],
|
|
18
|
-
getNumberFormatSettings: () => ({ decimalSeparator: '.', groupingSeparator: ',' }),
|
|
19
|
-
getCalendar: () => 'gregorian',
|
|
20
|
-
getCountry: () => 'US',
|
|
21
|
-
getCurrencies: () => ['USD'],
|
|
22
|
-
getTemperatureUnit: () => 'celsius',
|
|
23
|
-
getTimeZone: () => 'America/New_York',
|
|
24
|
-
uses24HourClock: () => true,
|
|
25
|
-
usesMetricSystem: () => true,
|
|
26
|
-
addEventListener: vi.fn(),
|
|
27
|
-
removeEventListener: vi.fn(),
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Mock @shopify/react-native-skia (vitest-compatible version of jestSetup.js)
|
|
31
|
-
vi.mock('@shopify/react-native-skia/lib/commonjs/Platform', () => {
|
|
32
|
-
const Noop = () => undefined
|
|
33
|
-
return {
|
|
34
|
-
OS: 'web',
|
|
35
|
-
PixelRatio: 1,
|
|
36
|
-
requireNativeComponent: Noop,
|
|
37
|
-
resolveAsset: Noop,
|
|
38
|
-
findNodeHandle: Noop,
|
|
39
|
-
NativeModules: Noop,
|
|
40
|
-
View: Noop,
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
vi.mock('@shopify/react-native-skia/lib/commonjs/skia/core/Font', () => {
|
|
45
|
-
return {
|
|
46
|
-
useFont: () => null,
|
|
47
|
-
matchFont: () => null,
|
|
48
|
-
listFontFamilies: () => [],
|
|
49
|
-
useFonts: () => null,
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
vi.mock('@shopify/react-native-skia', async () => {
|
|
54
|
-
try {
|
|
55
|
-
const mock = await vi.importActual<{ Mock: (canvasKit: unknown) => unknown }>(
|
|
56
|
-
'@shopify/react-native-skia/lib/commonjs/mock',
|
|
57
|
-
)
|
|
58
|
-
// CanvasKit may not be available, provide a fallback
|
|
59
|
-
return mock.Mock(global.CanvasKit ?? {})
|
|
60
|
-
} catch {
|
|
61
|
-
// Fallback if mock import fails
|
|
62
|
-
return {}
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
vi.mock('react-native-localize', () => mockRNLocalize)
|
|
67
|
-
vi.mock('lx/src/features/language/LocalizationContext', () => mockLocalizationContext({}))
|
|
68
|
-
vi.mock('lx/src/data/apiClients/SharedPersistQueryClientProvider', () => mockSharedPersistQueryClientProvider)
|
|
69
|
-
|
|
70
|
-
vi.mock('@luxfi/utilities/src/device/uniqueId', async () => {
|
|
71
|
-
return await vi.importActual('./src/test/mocks/uniqueId')
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
// Note: @luxexchange/gating partial mocks should be done in individual test files that need them
|
|
75
|
-
// The global mock was causing issues because vi.importActual returns a promise that wasn't
|
|
76
|
-
// being properly resolved before the mock was accessed
|