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

feat(everstake): added everstake solana user agent #17372

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

TomasBoda
Copy link
Contributor

Description

Updated Everstake Solana SDK and added user agent.

Related Issue

Resolve #17315

@TomasBoda TomasBoda self-assigned this Mar 4, 2025
@TomasBoda TomasBoda requested a review from tomasklim March 4, 2025 10:03
Copy link

coderabbitai bot commented Mar 4, 2025

Walkthrough

The pull request updates dependency versions and modifies the instantiation of the Solana client across multiple modules. Both the blockchain-link and wallet-utils packages have updated the @everstake/wallet-sdk-solana dependency from version 2.0.5 to 2.0.8. Additionally, the wallet-utils package now includes a new dependency on @trezor/env-utils. Code changes in both the stakingAccounts.ts and solanaStakingUtils.ts files introduce an import of the getSuiteVersion function from @trezor/env-utils and adjust the configuration passed to the Solana constructor. Instead of passing a single URL string, the instantiation now receives an object containing an rpc property (the server URL) and a userAgent property that incorporates the Trezor Suite version. A new reference to the env-utils package has also been added in the tsconfig.json file for the wallet-utils module.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c5ed22e and 09a2278.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • packages/blockchain-link/package.json (1 hunks)
  • packages/blockchain-link/src/workers/solana/stakingAccounts.ts (2 hunks)
  • suite-common/wallet-utils/package.json (2 hunks)
  • suite-common/wallet-utils/src/solanaStakingUtils.ts (2 hunks)
  • suite-common/wallet-utils/tsconfig.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/blockchain-link/package.json
  • packages/blockchain-link/src/workers/solana/stakingAccounts.ts
  • suite-common/wallet-utils/package.json
  • suite-common/wallet-utils/src/solanaStakingUtils.ts
⏰ Context from checks skipped due to timeout of 90000ms (15)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: transport-e2e-test
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (1)
suite-common/wallet-utils/tsconfig.json (1)

25-25: New Reference Addition for env-utils
The addition of { "path": "../../packages/env-utils" } integrates the new dependency as intended by the PR objectives, enabling type-resolution and functionality usage from the env-utils package in the wallet-utils module. Please ensure that the relative path remains correct relative to the project structure during future refactors or restructuring.


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.

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 (2)
packages/blockchain-link/src/workers/solana/stakingAccounts.ts (1)

19-22: User agent implementation looks good.

The Solana client initialization has been properly updated to include a user agent string with the Trezor Suite version. This follows best practices for API clients by identifying the source of requests, which can help with debugging, tracking, and proper rate limiting on the Solana RPC servers.

Consider extracting the user agent prefix string "Trezor Suite" into a shared constant to ensure consistent naming across the codebase.

- userAgent: `Trezor Suite ${getSuiteVersion()}`,
+ userAgent: `${USER_AGENT_PREFIX} ${getSuiteVersion()}`,
suite-common/wallet-utils/src/solanaStakingUtils.ts (1)

51-54:

❓ Verification inconclusive

User agent implementation looks good.

The Solana client initialization has been properly updated to include a user agent string with the Trezor Suite version. This implementation is consistent with the changes in stakingAccounts.ts, which is good for maintaining code uniformity.

Consider extracting the user agent string format into a shared utility or constant to ensure consistency across different files.

- userAgent: `Trezor Suite ${getSuiteVersion()}`,
+ userAgent: `${USER_AGENT_PREFIX} ${getSuiteVersion()}`,

You might also want to verify whether the Solana RPC servers receive the user agent correctly with this implementation:


🏁 Script executed:

#!/bin/bash
# Check if the updated SDK properly forwards the user agent to the Solana RPC servers

# Looking for any configuration or middleware in the updated SDK version that handles user agent
rg -A 5 "userAgent" --glob "node_modules/@everstake/wallet-sdk-solana/**/*.js"

# Check for any HTTP request implementation in the SDK that might use the user agent
rg -A 5 "fetch\(" --glob "node_modules/@everstake/wallet-sdk-solana/**/*.js"
rg -A 5 "axios" --glob "node_modules/@everstake/wallet-sdk-solana/**/*.js"

Length of output: 679


User Agent Implementation Looks Good; Manual Verification for SDK Forwarding Recommended

The updated Solana client initialization correctly injects the Trezor Suite version into the user agent, in line with the changes in stakingAccounts.ts. Great work on maintaining consistency!

Key points:

  • The code in suite-common/wallet-utils/src/solanaStakingUtils.ts (lines 51–54) sets the user agent as:
        return new Solana(network, {
            rpc: url,
            userAgent: `Trezor Suite ${getSuiteVersion()}`,
        });
  • As a good-to-have improvement, consider extracting the user agent format into a shared constant:
    - userAgent: `Trezor Suite ${getSuiteVersion()}`,
    + userAgent: `${USER_AGENT_PREFIX} ${getSuiteVersion()}`,
  • Note: The automated check intended to verify if the SDK forwards the user agent string didn’t yield any output—likely because default filters (e.g., ignoring node_modules) prevented a meaningful search. Please perform a manual verification (or update the script to disable ignore rules) to confirm that RPC calls from the Solana SDK properly include the user agent.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ea18d30 and c5ed22e.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • packages/blockchain-link/package.json (1 hunks)
  • packages/blockchain-link/src/workers/solana/stakingAccounts.ts (2 hunks)
  • suite-common/wallet-utils/package.json (2 hunks)
  • suite-common/wallet-utils/src/solanaStakingUtils.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: EAS Update
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (5)
packages/blockchain-link/package.json (1)

75-75: SDK version upgrade correctly implemented.

The dependency on @everstake/wallet-sdk-solana has been updated from v2.0.5 to v2.0.8, which is consistent with the SDK update requirements for the Everstake Solana integration.

packages/blockchain-link/src/workers/solana/stakingAccounts.ts (1)

4-4: Well-structured import for the user agent functionality.

Good addition of the getSuiteVersion utility to provide version information for the user agent.

suite-common/wallet-utils/package.json (2)

15-15: SDK version upgrade correctly implemented.

The dependency on @everstake/wallet-sdk-solana has been updated from v2.0.5 to v2.0.8, matching the version update in the blockchain-link package.


29-29: Necessary dependency added correctly.

The @trezor/env-utils dependency has been properly added to access the getSuiteVersion function used for the user agent implementation.

suite-common/wallet-utils/src/solanaStakingUtils.ts (1)

11-11: Well-structured import for the user agent functionality.

Good addition of the getSuiteVersion utility for providing version information in the user agent.

Copy link

github-actions bot commented Mar 4, 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

@tomasklim tomasklim added the release Will be included in the upcoming release. Needs to be backported to the release branch. label Mar 4, 2025
@tomasklim tomasklim force-pushed the feat/everstake-sol-user-agent branch from c5ed22e to 09a2278 Compare March 4, 2025 13:37
Copy link
Member

@tomasklim tomasklim left a comment

Choose a reason for hiding this comment

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

LGTM, impossible to test this I think

@tomasklim tomasklim merged commit 27851d5 into develop Mar 4, 2025
73 checks passed
@tomasklim tomasklim deleted the feat/everstake-sol-user-agent branch March 4, 2025 14:12
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
None yet
Development

Successfully merging this pull request may close these issues.

Everstake SDK Solana user agent
2 participants