Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(trading): rename package from invity to trading #16628

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

adderpositive
Copy link
Contributor

@adderpositive adderpositive commented Jan 27, 2025

Description

  • Rename package from invity to trading

Related Issue

Resolve #16627

Summary by CodeRabbit

Based on the comprehensive summary, here are the release notes:

Release Notes

  • Module Reorganization

    • Migrated trading-related functionality from @suite-common/invity to @suite-common/trading
    • Updated import paths across multiple components and files
  • Type System Improvements

    • Introduced new trade status types for buy, sell, and exchange trades
    • Added TradingUtilsProvidersProps to enhance provider information handling
  • Dependency Updates

    • Removed dependency on @suite-common/invity
    • Added dependency on @suite-common/trading

No functional changes to the core trading logic were made during this refactoring.

@adderpositive adderpositive added +Invity Related to Invity project code Code improvements labels Jan 27, 2025
@adderpositive adderpositive self-assigned this Jan 27, 2025
@adderpositive adderpositive force-pushed the chore/rename-package-from-invity-to-trading branch from 7da149b to 7a03976 Compare January 27, 2025 16:46
Copy link

github-actions bot commented Jan 27, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 24
  • More info

Learn more about 𝝠 Expo Github Action

Copy link
Contributor

@vytick vytick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@vytick vytick self-requested a review January 27, 2025 21:33
@adderpositive adderpositive linked an issue Jan 28, 2025 that may be closed by this pull request
@adderpositive adderpositive force-pushed the chore/rename-coinmarket-to-trading branch 2 times, most recently from 4ecc9df to 57fa3ea Compare January 29, 2025 08:26
Base automatically changed from chore/rename-coinmarket-to-trading to develop January 29, 2025 12:10
@adderpositive adderpositive force-pushed the chore/rename-package-from-invity-to-trading branch from 7a03976 to 197490f Compare January 29, 2025 17:08
@adderpositive adderpositive marked this pull request as ready for review January 29, 2025 17:17
Copy link

coderabbitai bot commented Jan 30, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

error Error: http://10.0.0.28:4873/@trezor%2feslint: no such package available
at params.callback [as _callback] (/opt/yarn-v1.22.22/lib/cli.js:66685:18)
at self.callback (/opt/yarn-v1.22.22/lib/cli.js:141415:22)
at Request.emit (node:events:519:28)
at Request. (/opt/yarn-v1.22.22/lib/cli.js:142387:10)
at Request.emit (node:events:519:28)
at IncomingMessage. (/opt/yarn-v1.22.22/lib/cli.js:142309:12)
at Object.onceWrapper (node:events:633:28)
at IncomingMessage.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1698:12)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Walkthrough

The pull request involves a comprehensive renaming and reorganization of the trading-related module from @suite-common/invity to @suite-common/trading. This change affects multiple packages, primarily focusing on updating import statements, package configurations, and type definitions across the Trezor Suite codebase. The modifications ensure that all references to the previous module are updated to point to the new trading module while maintaining the existing functionality.

Changes

File/Path Change Summary
packages/suite/package.json Removed @suite-common/invity dependency, added @suite-common/trading
packages/suite/tsconfig.json Removed invity reference, added trading reference
suite-common/trading/package.json Renamed package name from @suite-common/invity to @suite-common/trading
Multiple source files Updated import statements from @suite-common/invity to @suite-common/trading
suite-common/trading/src/types.ts Added new type definitions for trading statuses and providers

Assessment against linked issues

Objective Addressed Explanation
Rename package from invity to trading

Poem

🐰 A Trading Tale of Transformation

From Invity to Trading, we dance and prance,
Refactoring types with a rabbit's glance,
Import paths shift like wind through the trees,
Modules renamed with algorithmic ease!

🔄✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuyPaymentWaitingForUser.tsx (1)

Line range hint 89-89: Consider addressing the TODO comment in a separate issue.

There's a TODO comment about adding transaction cancellation functionality. While not directly related to the package renaming, it would be good practice to track this as a separate issue.

Would you like me to create a new issue to track the implementation of the transaction cancellation feature?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0e4e70 and 1e65425.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (64)
  • packages/suite-desktop-core/e2e/support/pageActions/marketActions.ts (1 hunks)
  • packages/suite/package.json (1 hunks)
  • packages/suite/src/actions/wallet/__tests__/tradingBuyActions.test.ts (1 hunks)
  • packages/suite/src/actions/wallet/__tests__/tradingExchangeActions.test.ts (1 hunks)
  • packages/suite/src/actions/wallet/trading/tradingCommonActions.ts (1 hunks)
  • packages/suite/src/actions/wallet/tradingBuyActions.ts (1 hunks)
  • packages/suite/src/actions/wallet/tradingExchangeActions.ts (1 hunks)
  • packages/suite/src/actions/wallet/tradingSellActions.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/common/useTradingBuildAccountGroups.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/common/useTradingPreviousRoute.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/useTradingBuyForm.tsx (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/useTradingCommonForm.tsx (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/useTradingExchangeForm.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/useTradingExchangeWatchSendApproval.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/form/useTradingSellForm.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/useServerEnviroment.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/useTradingDetail.ts (1 hunks)
  • packages/suite/src/hooks/wallet/trading/useTradingWatchTrade.ts (1 hunks)
  • packages/suite/src/middlewares/wallet/__tests__/tradingMiddleware.test.ts (2 hunks)
  • packages/suite/src/middlewares/wallet/tradingMiddleware.ts (1 hunks)
  • packages/suite/src/reducers/suite/suiteReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/tradingReducer.ts (1 hunks)
  • packages/suite/src/types/trading/trading.ts (1 hunks)
  • packages/suite/src/types/trading/tradingDetail.ts (1 hunks)
  • packages/suite/src/types/trading/tradingForm.ts (1 hunks)
  • packages/suite/src/utils/wallet/trading/tradingTypingUtils.ts (1 hunks)
  • packages/suite/src/utils/wallet/trading/tradingUtils.ts (1 hunks)
  • packages/suite/src/views/settings/SettingsDebug/InvityApi.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuy.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuyPaymentWaitingForUser.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailExchange/TradingDetailExchange.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailSell/TradingDetailSell.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersAmounts.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersItem.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersPaymentInfo.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormInput/TradingFormInputCountry.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffer.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOfferItem.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffersSwitcher.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffersSwitcherItem.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingHeader/TradingExchangeHeaderSummary.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingHeader/TradingOffersExchangeFiltersPanel.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingLayout/TradingLayoutHeader.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingOffers/TradingOffersExchange.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingPaymentPlainType.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingPaymentType.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingProviderInfo.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoExchangeType.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoItem.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoPaymentMethod.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchange.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSend.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSendApproval.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSendSwap.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSell.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSellBankAccount.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSellTransaction.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingTransactions/TradingTransaction/TradingTransactionProvider.tsx (1 hunks)
  • packages/suite/src/views/wallet/trading/common/TradingUtils/TradingUtilsProvider.tsx (1 hunks)
  • packages/suite/tsconfig.json (1 hunks)
  • suite-common/trading/package.json (1 hunks)
  • suite-common/trading/src/invityAPI.ts (1 hunks)
  • suite-common/trading/src/types.ts (2 hunks)
✅ Files skipped from review due to trivial changes (26)
  • suite-common/trading/package.json
  • packages/suite/src/reducers/wallet/tradingReducer.ts
  • packages/suite/src/actions/wallet/tradingSellActions.ts
  • suite-common/trading/src/invityAPI.ts
  • packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersItem.tsx
  • packages/suite/src/actions/wallet/tests/tradingBuyActions.test.ts
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchange.tsx
  • packages/suite/src/actions/wallet/tradingExchangeActions.ts
  • packages/suite/src/actions/wallet/trading/tradingCommonActions.ts
  • packages/suite/src/types/trading/tradingForm.ts
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSendSwap.tsx
  • packages/suite/src/hooks/wallet/trading/form/useTradingSellForm.ts
  • packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffer.tsx
  • packages/suite/src/hooks/wallet/trading/form/useTradingBuyForm.tsx
  • packages/suite/src/hooks/wallet/trading/form/common/useTradingPreviousRoute.ts
  • packages/suite/src/utils/wallet/trading/tradingTypingUtils.ts
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoPaymentMethod.tsx
  • packages/suite/src/actions/wallet/tradingBuyActions.ts
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSendApproval.tsx
  • packages/suite/src/utils/wallet/trading/tradingUtils.ts
  • packages/suite/src/hooks/wallet/trading/form/useTradingExchangeForm.ts
  • packages/suite/src/hooks/wallet/trading/form/useTradingExchangeWatchSendApproval.ts
  • packages/suite/src/actions/wallet/tests/tradingExchangeActions.test.ts
  • packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingVerify/TradingVerify.tsx
  • packages/suite/src/reducers/suite/suiteReducer.ts
  • packages/suite/src/middlewares/wallet/tradingMiddleware.ts
🔇 Additional comments (48)
packages/suite/src/middlewares/wallet/__tests__/tradingMiddleware.test.ts (2)

2-2: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' as part of the package rename.


16-16: LGTM! Jest mock path updated consistently.

The Jest mock path has been updated to match the new package name while maintaining the same mock implementation.

packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffersSwitcherItem.tsx (2)

6-6: LGTM! Import path updated correctly.

The import path has been updated from the old path to @suite-common/trading which aligns with the PR objective of renaming the package.

✅ Verification successful

Import path update verification complete - all imports are consistent

The verification confirms that all imports across the codebase are consistently using '@suite-common/trading' with no remaining references to the old path.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all similar imports have been consistently updated across the codebase
rg "from '@suite-common/(invity|trading)'" --type ts

Length of output: 8901


Line range hint 1-1: Verify if invity-api import should be updated.

The import from invity-api might need to be updated for consistency with the package renaming from invity to trading.

packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormInput/TradingFormInputCountry.tsx (1)

5-5: LGTM! Import path updated correctly.

The change aligns with the PR objective of renaming the package from 'invity' to 'trading'.

Let's verify that the module exists in the new location:

✅ Verification successful

Import path change verified successfully

The regional module with its countriesOptions export exists and is properly exported from the new @suite-common/trading package location.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the regional module exists in the new package
# and that all its exports are maintained

# Check if the module exists in the new location
rg -g '*.{ts,tsx}' -l "export.*regional" "packages/suite-common/trading/"

# Verify that countriesOptions is still exported
ast-grep --pattern 'export const regional = {
  $$$
  countriesOptions: $_,
  $$$
}'

Length of output: 231


Script:

#!/bin/bash
# First, let's understand the repository structure
fd -t d "suite-common"

# Find any files containing 'regional' exports in both old and new packages
rg -g '*.{ts,tsx}' -l "export.*regional"

# Search for any references to countriesOptions
rg -g '*.{ts,tsx}' "countriesOptions"

Length of output: 479

packages/suite/src/views/wallet/trading/common/TradingTransactions/TradingTransaction/TradingTransactionProvider.tsx (1)

1-1: LGTM! Verify consistent package renaming across the codebase.

The import statement has been correctly updated from @suite-common/invity to @suite-common/trading, which aligns with the PR objective.

Let's verify that all imports from the old package have been updated consistently:

✅ Verification successful

Import paths correctly updated, package.json references are valid

The verification confirms that:

  • All imports from '@suite-common/invity' have been properly updated
  • Remaining references to 'invity' are only in package.json files and specifically for '@types/invity-api' type definitions, which is correct as these are external type definitions that should maintain their original naming
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports from @suite-common/invity
# Expected: No results, as all imports should have been updated

echo "Checking for any remaining imports from @suite-common/invity..."
rg "from ['|\"]@suite-common/invity['|\"]"

echo "Checking for any remaining references to invity in package.json files..."
fd package.json --exec rg -l "invity"

Length of output: 444


Script:

#!/bin/bash
# Check the context of 'invity' references in package.json files
echo "Content of suite-common/trading/package.json with invity references:"
cat suite-common/trading/package.json | grep -A 2 -B 2 "invity"

echo -e "\nContent of packages/suite/package.json with invity references:"
cat packages/suite/package.json | grep -A 2 -B 2 "invity"

Length of output: 672

packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuyPaymentWaitingForUser.tsx (2)

8-8: LGTM! Import updated correctly.

The import statement has been properly updated from '@suite-common/invity' to '@suite-common/trading' as part of the package renaming effort.


Line range hint 4-4: Verify if 'invity-api' package should also be renamed.

While we're renaming from 'invity' to 'trading', there's still an import from 'invity-api'. Let's verify if this package should also be part of the renaming effort.

✅ Verification successful

Keep the 'invity-api' package name as is

The 'invity-api' package appears to be an external dependency containing API type definitions and should not be renamed as part of the migration from 'invity' to 'trading'. Renaming it would break compatibility with the external service.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if 'invity-api' is an external dependency or part of the monorepo
echo "Checking package.json files for invity-api dependency..."
find . -name "package.json" -type f -exec grep -l "invity-api" {} \;

# Check if there are other usages of invity-api in the codebase
echo "Checking other usages of invity-api..."
rg "from 'invity-api'" --type ts --type tsx

Length of output: 425


Script:

#!/bin/bash
# Check package.json contents
echo "Content of packages/suite/package.json:"
cat packages/suite/package.json | jq '.dependencies["invity-api"]'

echo "Content of suite-common/trading/package.json:"
cat suite-common/trading/package.json | jq '.dependencies["invity-api"]'

# Search for invity-api package directory
echo "Searching for invity-api package directory:"
fd -t d "invity-api$"

# Properly search for invity-api imports
echo "Searching for invity-api imports:"
rg "from ['\"']invity-api" --type typescript --type-add 'typescript:*.{ts,tsx}'

Length of output: 9181

packages/suite/src/hooks/wallet/trading/useServerEnviroment.ts (1)

1-1: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' while maintaining the existing functionality.

packages/suite/src/hooks/wallet/trading/form/useTradingCommonForm.tsx (1)

3-3: LGTM! Type import path updated correctly.

The type import path has been updated from '@suite-common/invity' to '@suite-common/trading' while maintaining type safety.

packages/suite/src/views/wallet/trading/common/TradingPaymentType.tsx (1)

3-3: LGTM! API and type imports updated correctly.

The import path for both invityAPI and TradingPaymentMethodType has been updated from '@suite-common/invity' to '@suite-common/trading' while maintaining functionality.

packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersPaymentInfo.tsx (1)

4-4: LGTM! Type import path updated correctly.

The type import path has been updated from '@suite-common/invity' to '@suite-common/trading' while maintaining type safety.

Let's verify that the package dependencies have been updated correctly:

✅ Verification successful

Dependencies verified: Import path migration is complete and correct

The package dependencies and import references have been properly updated:

  • '@suite-common/trading' is correctly configured as a workspace dependency
  • No remaining references to '@suite-common/invity' found in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify package dependencies and references
# Check for any remaining references to '@suite-common/invity'

echo "Checking for remaining references to '@suite-common/invity'..."
rg -l "@suite-common/invity"

echo "Checking package.json for dependency updates..."
cat packages/suite/package.json | jq '.dependencies["@suite-common/trading"], .dependencies["@suite-common/invity"]'

Length of output: 412

packages/suite/src/types/trading/tradingDetail.ts (1)

2-2: LGTM! Import path updated correctly.

The import path change from '@suite-common/invity' to '@suite-common/trading' aligns with the package renaming objective.

packages/suite/src/views/wallet/trading/common/TradingPaymentPlainType.tsx (1)

1-1: LGTM! Import path updated correctly.

The import path change from '@suite-common/invity' to '@suite-common/trading' aligns with the package renaming objective.

packages/suite/src/views/wallet/trading/common/TradingUtils/TradingUtilsProvider.tsx (1)

5-5: LGTM! Import path updated correctly.

The import path change from 'src/types/trading/trading' to '@suite-common/trading' aligns with the package renaming objective. The addition of invityAPI import is consistent with its usage in the component.

packages/suite/src/views/wallet/trading/common/TradingProviderInfo.tsx (1)

3-3: LGTM! Import path updated correctly.

The import path change from '@suite-common/invity' to '@suite-common/trading' aligns with the package renaming objective.

suite-common/trading/src/types.ts (2)

33-33: LGTM! Good type aggregation.

The TradingTradeStatusType effectively combines the status types from buy, sell, and exchange trades into a single union type.


34-40: LGTM! Well-structured provider props type.

The TradingUtilsProvidersProps type provides a clear interface for provider information with appropriate optional fields.

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoExchangeType.tsx (1)

4-4: LGTM! Correct package import update.

Import correctly updated from '@suite-common/invity' to '@suite-common/trading' while maintaining the 'invity-api' dependency.

packages/suite/src/hooks/wallet/trading/form/common/useTradingBuildAccountGroups.ts (1)

4-4: LGTM! Correct package import update.

Import correctly updated from '@suite-common/invity' to '@suite-common/trading' while maintaining the hook's functionality.

packages/suite/src/views/settings/SettingsDebug/InvityApi.tsx (2)

3-4: LGTM! Correct package import updates.

Imports correctly updated from '@suite-common/invity' to '@suite-common/trading'.


Line range hint 1-52: Consider renaming component and references for consistency.

Since we're moving from 'invity' to 'trading', consider updating the following for naming consistency:

  • Component name from InvityApi to TradingApi
  • Variable names from invityAPI to tradingAPI
  • Text references from "Invity" to "Trading"
-export const InvityApi = () => {
+export const TradingApi = () => {
     const debug = useSelector(state => state.suite.settings.debug);
     const dispatch = useDispatch();
 
-    const invityApiServerOptions = Object.entries(invityAPI.SERVERS).map(
+    const tradingApiServerOptions = Object.entries(tradingAPI.SERVERS).map(
         ([environment, server]) => ({
             label: server,
             value: environment as InvityServerEnvironment,
         }),
     );
-    const selectedInvityApiServer =
-        invityApiServerOptions.find(s => s.value === debug.invityServerEnvironment) ||
-        invityApiServerOptions[0];
+    const selectedTradingApiServer =
+        tradingApiServerOptions.find(s => s.value === debug.invityServerEnvironment) ||
+        tradingApiServerOptions[0];
 
     const handleChange = (item: { value: InvityServerEnvironment; label: string }) => {
         dispatch(setDebugMode({ invityServerEnvironment: item.value }));
-        invityAPI.setInvityServersEnvironment(item.value);
+        tradingAPI.setTradingServersEnvironment(item.value);
         reloadApp(100);
     };

Let's verify if there are other occurrences of "Invity" in the codebase that should be renamed:

packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOfferItem.tsx (1)

1-1: LGTM! Import path updated correctly.

The import statement has been properly updated to use the new @suite-common/trading package.

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingInfo/TradingInfoItem.tsx (1)

6-6: LGTM! Import path updated correctly.

The import statement has been properly updated to use the new @suite-common/trading package while correctly maintaining the separate invity-api import.

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSell.tsx (1)

5-5: LGTM! Import path updated correctly.

The import statement has been properly updated to use the new @suite-common/trading package.

packages/suite/src/views/wallet/trading/common/TradingHeader/TradingOffersExchangeFiltersPanel.tsx (2)

5-5: LGTM! Import path updated correctly.

The import statement has been properly updated to use the new @suite-common/trading package.


Line range hint 1-85: Verify all imports are updated consistently across the codebase.

Let's ensure all imports from @suite-common/invity have been updated to @suite-common/trading throughout the codebase.

✅ Verification successful

All imports have been successfully migrated from @suite-common/invity to @suite-common/trading

The migration has been consistently applied across the entire codebase with no remaining references to the old import path.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports from @suite-common/invity
# and verify that @suite-common/trading is used consistently

echo "Checking for any remaining @suite-common/invity imports..."
rg -l "@suite-common/invity"

echo -e "\nVerifying @suite-common/trading imports..."
rg -l "@suite-common/trading"

echo -e "\nChecking package.json for dependencies..."
find . -name "package.json" -exec grep -l "suite-common/[invity|trading]" {} \;

Length of output: 7458

packages/suite/src/views/wallet/trading/common/TradingHeader/TradingExchangeHeaderSummary.tsx (1)

7-7: LGTM! Import path correctly updated.

The change from '@suite-common/invity' to '@suite-common/trading' is consistent with the package renaming objective.

packages/suite/src/views/wallet/trading/common/TradingLayout/TradingLayoutHeader.tsx (1)

6-6: LGTM! Import path correctly updated.

The change from '@suite-common/invity' to '@suite-common/trading' is consistent with the package renaming objective.

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferExchange/TradingOfferExchangeSend.tsx (1)

5-5: LGTM! Import path correctly updated.

The change from '@suite-common/invity' to '@suite-common/trading' is consistent with the package renaming objective.

packages/suite/src/views/wallet/trading/common/TradingOffers/TradingOffersExchange.tsx (1)

5-5: LGTM! Import path correctly updated.

The change from '@suite-common/invity' to '@suite-common/trading' is consistent with the package renaming objective.

packages/suite/src/hooks/wallet/trading/useTradingDetail.ts (1)

3-3: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' as part of the package renaming.

packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailSell/TradingDetailSell.tsx (1)

4-4: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' as part of the package renaming.

packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailBuy/TradingDetailBuy.tsx (1)

4-4: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' as part of the package renaming.

packages/suite/src/views/wallet/trading/common/TradingFeaturedOffers/TradingFeaturedOffersAmounts.tsx (3)

8-8: LGTM! Import path updated correctly.

The import path has been updated from '@suite-common/invity' to '@suite-common/trading' as part of the package renaming.


Line range hint 1-1: Overall Assessment: Changes look good with one consideration.

The import path updates from '@suite-common/invity' to '@suite-common/trading' are consistent across all files. However, there are still references to the 'invity-api' package in some files. It would be helpful to clarify if these dependencies should also be updated as part of the package renaming effort.


Line range hint 4-4: Verify if 'invity-api' dependency should also be updated.

The file still imports CryptoId from 'invity-api'. Since we're renaming the package from 'invity' to 'trading', should this dependency also be updated for consistency?

packages/suite/src/views/wallet/trading/common/TradingDetail/TradingDetailExchange/TradingDetailExchange.tsx (1)

4-4: LGTM! Import statement correctly updated.

The import statement has been properly updated to use the new package name while maintaining the same type usage throughout the file.

packages/suite/src/views/wallet/trading/common/TradingForm/TradingFormOffersSwitcher.tsx (1)

3-3: LGTM! Multiple types correctly imported from new package.

The import statement has been properly updated to import both types from the new package location while maintaining their correct usage in the component.

packages/suite/src/hooks/wallet/trading/useTradingWatchTrade.ts (1)

14-14: LGTM! Imports correctly updated while maintaining external dependencies.

The import statements have been properly updated to use the new package name while correctly maintaining the external 'invity-api' dependencies.

Let's verify that all necessary types have been moved to the trading package:

Also applies to: 20-20

✅ Verification successful

Import changes are correct and properly maintain external dependencies

The verification confirms that:

  • Types are correctly imported from '@suite-common/trading'
  • External invity-api dependencies are properly maintained
  • No lingering references to the old package structure were found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any remaining references to invity in the codebase
# excluding node_modules and the invity-api package

rg -g '!{node_modules,**/invity-api/**}' '@suite-common/invity'

Length of output: 63


Script:

#!/bin/bash
# Check for the specific types in the trading package
echo "=== Checking trading package for types ==="
ast-grep --pattern 'type TradingTradeStatusType'
ast-grep --pattern 'type TradingType'

echo -e "\n=== Checking for any remaining invity type references ==="
rg -g '!{node_modules,**/invity-api/**}' 'from.*invity.*Type'

echo -e "\n=== Checking the structure of trading types ==="
fd trading.ts --exec cat {}

Length of output: 10700

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSellTransaction.tsx (1)

5-5: LGTM! Import statement correctly updated.

The import statement has been properly updated to use the new package name while maintaining the correct type usage in the component.

packages/suite/src/views/wallet/trading/common/TradingSelectedOffer/TradingOfferSell/TradingOfferSellBankAccount.tsx (1)

8-8: LGTM!

The import path update from @suite-common/invity to @suite-common/trading aligns with the package renaming objective.

packages/suite/src/types/trading/trading.ts (1)

28-28: LGTM!

The import path update from @suite-common/invity to @suite-common/trading aligns with the package renaming objective.

packages/suite-desktop-core/e2e/support/pageActions/marketActions.ts (1)

5-5: LGTM!

The import path update from @suite-common/invity to @suite-common/trading aligns with the package renaming objective.

packages/suite/tsconfig.json (1)

68-68: LGTM! Verify complete transition from invity to trading.

The addition of the trading module reference aligns with the package renaming objective.

Run the following script to verify that all references to the old invity module have been removed:

packages/suite/package.json (3)

52-52: LGTM: Addition of trading package dependency.

The addition of @suite-common/trading aligns with the PR objective of renaming the package.


Line range hint 156-156: Consider removing or updating @types/invity-api dependency.

Since we're renaming from invity to trading, the @types/invity-api devDependency might need to be updated or removed to maintain consistency.

Let's verify the usage of these types across the codebase:


Line range hint 1-180: Verify complete migration from invity to trading.

Let's ensure all necessary dependencies have been updated consistently.

✅ Verification successful

Migration from invity to trading is complete

The migration is successfully completed. The only remaining references are type definitions (@types/invity-api) and configuration-related types (InvityServerEnvironment), which don't affect runtime behavior. No business logic, components, or runtime dependencies were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Comprehensive check for remaining invity references

# Check package.json files across the monorepo
echo "Checking package.json files for invity dependencies..."
find . -name "package.json" -type f -exec grep -l "invity" {} \;

# Check for any remaining invity imports in source files
echo "Checking source files for invity imports..."
rg "from ['\"]@suite-common/invity['\"]"

# Check for any remaining invity string literals
echo "Checking for invity string literals..."
rg "invity" --type ts --type tsx --type js --type jsx --type json

Length of output: 575


Script:

#!/bin/bash
# Description: Detailed check for remaining invity references with fixed commands

# Check content of identified package.json files
echo "Content of suite/package.json invity references:"
cat ./packages/suite/package.json | grep -A 2 -B 2 "invity"

echo -e "\nContent of trading/package.json invity references:"
cat ./suite-common/trading/package.json | grep -A 2 -B 2 "invity"

# Check for invity string literals with correct file type handling
echo -e "\nChecking for invity string literals in source files:"
rg "invity" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' --type ts --type tsx --type js --type jsx --type json

# Check for invity types and interfaces
echo -e "\nChecking for invity types and interfaces:"
rg "type.*Invity|interface.*Invity|enum.*Invity" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' --type ts --type tsx

Length of output: 1561


Script:

#!/bin/bash
# Description: Final check for invity business logic and components

# Check for invity-related components and business logic
echo "Checking for invity-related components and logic:"
rg "invity" --type=typescript --type=javascriptreact --type=typescriptreact -g '!*.d.ts' -g '!package.json' -B 3 -A 3

# Check for any invity URLs or API endpoints
echo -e "\nChecking for invity URLs and endpoints:"
rg "invity\.(com|io|org)|api\.invity" --type=typescript --type=javascriptreact --type=typescriptreact --type=json

# Check for invity-related imports and exports
echo -e "\nChecking for invity-related imports and exports:"
rg "import.*invity|export.*invity" --type=typescript --type=javascriptreact --type=typescriptreact

Length of output: 756


Script:

#!/bin/bash
# Description: Final verification with correct ripgrep syntax

# Check for any invity-related code (excluding types and package.json)
echo "Checking for invity-related code:"
rg "invity" -t ts -t tsx -t js -t jsx -g '!*.d.ts' -g '!package.json' -B 3 -A 3

# Check for invity URLs and endpoints
echo -e "\nChecking for invity URLs and endpoints:"
rg "invity\.(com|io|org)|api\.invity" -t ts -t tsx -t js -t jsx -t json

# Check for invity-related imports and exports
echo -e "\nChecking for invity-related imports and exports:"
rg "import.*invity|export.*invity" -t ts -t tsx -t js -t jsx

Length of output: 585

@adderpositive adderpositive force-pushed the chore/rename-package-from-invity-to-trading branch 5 times, most recently from 1a2d177 to 46b80fb Compare January 31, 2025 10:16
@izmy izmy force-pushed the chore/rename-package-from-invity-to-trading branch 2 times, most recently from 4425d89 to 24e7357 Compare January 31, 2025 16:04
@adderpositive adderpositive force-pushed the chore/rename-package-from-invity-to-trading branch from 9b5e65b to a8d3826 Compare February 3, 2025 08:15
@tomasklim tomasklim merged commit dbb7cf9 into develop Feb 3, 2025
73 checks passed
@tomasklim tomasklim deleted the chore/rename-package-from-invity-to-trading branch February 3, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code improvements +Invity Related to Invity project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename package from invity to trading
3 participants