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

Message system - Add context banner to solana staking #17267

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MiroslavProchazka
Copy link
Contributor

@MiroslavProchazka MiroslavProchazka commented Feb 26, 2025

This pull request includes several updates to support Solana staking and improve the context message system. The most important changes include adding support for Solana staking in the wallet layout, enhancing the context message component, updating the message system configuration, and modifying the message system types.

Support for Solana staking:

Enhancements to context message component:

Updates to message system configuration:

Modifications to message system types:

Screenshots:

image

Zaznam.obrazovky.2025-02-28.v.10.47.47.mov

Copy link

github-actions bot commented Feb 26, 2025

🚀 Expo preview is ready!

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

Learn more about 𝝠 Expo Github Action

@MiroslavProchazka MiroslavProchazka force-pushed the chore/context-sol branch 2 times, most recently from f55efb7 to 882540e Compare February 27, 2025 13:51
@MiroslavProchazka MiroslavProchazka changed the title test/test Add context banner to solana staking Feb 27, 2025
@MiroslavProchazka MiroslavProchazka changed the title Add context banner to solana staking Message system - Add context banner to solana staking Feb 27, 2025
@tomasklim tomasklim added the release Will be included in the upcoming release. Needs to be backported to the release branch. label Feb 27, 2025
@MiroslavProchazka MiroslavProchazka force-pushed the chore/context-sol branch 3 times, most recently from 3a45369 to 60e3b2d Compare February 28, 2025 08:47
@MiroslavProchazka MiroslavProchazka marked this pull request as ready for review February 28, 2025 09:49
Copy link

coderabbitai bot commented Feb 28, 2025

Walkthrough

The changes add support for Solana staking within the wallet module. In the AccountBanners component, a new function is imported to verify if an account symbol supports Solana staking, enabling conditional rendering of a related message when on the wallet-staking route. The ContextMessage component has been modified to adjust its handling of call-to-action links and incorporate state data for Tor-related routing. The message system configuration now has an incremented sequence and a new action for Trezor firmware updates, with conditions specified for different environments and an updated category format. Additionally, the message system types include a new context entry for Solana staking.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.
  • @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.

@MiroslavProchazka MiroslavProchazka force-pushed the chore/context-sol branch 4 times, most recently from d80d8c5 to c9a2cc5 Compare February 28, 2025 13:10
@MiroslavProchazka
Copy link
Contributor Author

Assembling @marekrjpolak for some code nazi review 🙏

@marekrjpolak
Copy link
Contributor

I didn't test anything but I believe this should do the same in a somehow cleaner manner. Don't trust, verify. 33686c6

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)
suite-common/message-system/config/config.v1.json (1)

1334-1334: Standardized Category Field Format

The category field for the action with ID "a3c3a3b7-efbe-4e39-9ffd-1836338e7811" is now updated to use an array format (i.e. ["banner"]) instead of a simple string. This modification improves consistency across the configuration. Ensure that any downstream code expects and correctly interprets the category value as an array.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 01ccb82 and 33686c6.

📒 Files selected for processing (4)
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx (2 hunks)
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx (2 hunks)
  • suite-common/message-system/config/config.v1.json (3 hunks)
  • suite-common/message-system/src/messageSystemTypes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • suite-common/message-system/src/messageSystemTypes.ts
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (2)
suite-common/message-system/config/config.v1.json (2)

4-4: Sequence Number Incremented

The configuration’s versioning is updated correctly by setting the sequence number to 82. This minor but important change ensures that clients recognize the new configuration version and load updated messages accordingly.


297-388: New Solana Staking Action Added

A new action has been introduced to support Solana staking. In this block the following key aspects are addressed:

  • The conditions include a "settings" check with { "sol": true } together with an environment constraint ("desktop": "<24.12.1", "mobile": "!", "web": "!").
  • The "devices" array now specifies four device models (T2B1, T3B1, T2T1, and T3T1) with firmware requirement <2.8.9.
  • The message content clearly instructs users to update their firmware for the best staking experience and the CTA links to the firmware-index.
  • The new property "context": { "domain": "accounts.sol.staking" } is included to properly integrate this action with the broader Solana staking support.

This implementation aligns well with the PR’s objectives. Please verify that the device conditions are fully aligned with the intended support criteria for Solana staking.

@MiroslavProchazka
Copy link
Contributor Author

Thanks a lot @marekrjpolak !
Should be ready for review - cc @tomasklim, @matejkriz

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)
suite-common/message-system/config/config.v1.json (1)

1386-1390: Category Field Consistency Check
While most banner actions now use the array format (e.g. "category": ["banner"] and "category": ["context"]), note that the action on lines 1386–1390 declares "category": "feature". For consistency across the message system configuration, you might want to consider updating this to an array format (e.g. "category": ["feature"]), unless the schema intentionally permits a single string for non-banner messages.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 33686c6 and 5c09e22.

📒 Files selected for processing (4)
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx (2 hunks)
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx (2 hunks)
  • suite-common/message-system/config/config.v1.json (3 hunks)
  • suite-common/message-system/src/messageSystemTypes.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • suite-common/message-system/src/messageSystemTypes.ts
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx
  • packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build-web
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
🔇 Additional comments (4)
suite-common/message-system/config/config.v1.json (4)

4-4: Sequence Number Update
The configuration’s sequence has been incremented from 81 to 82, which signals a new version of the configuration. This minor update is correct and ensures that downstream systems detect the changes.


297-388: New Solana Staking Action Added
A new action has been introduced for Solana staking. The conditions correctly trigger on settings with "sol": true and require the desktop and web environments to be above version 25.2.1. The added devices array correctly enforces a firmware condition ("firmware": "<2.8.9") for models T2B1, T3B1, T2T1, and T3T1. The message content is well localized with clear CTAs and includes a new context ("domain": "accounts.sol.staking"), which ties into the updated message system types. Please verify from the UI perspective that the internal link "firmware-index" is appropriately handled in the component logic.


353-365: Localization Consistency in Solana Staking Message
The content for the new Solana staking action is properly localized across languages. The messages consistently instruct users to update their Trezor firmware for the best staking experience. Double-check the copy in each language for trademark or technical accuracy, but overall this implementation is clean.


367-384: Consistent and Clear Call-to-Action Setup
The CTA in the new Solana staking banner uses an internal link to "firmware-index" with well-translated labels (e.g., “Update now”) across locales. This is consistent with our approach in other actions. If the UI leverages useMemo for action configuration as described in the PR objectives, please ensure that these values are correctly memoized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Will be included in the upcoming release. Needs to be backported to the release branch.
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

3 participants