Skip to content

chore: adds Solana support for the account overview#28411

Merged
zone-live merged 54 commits intodevelopfrom
SOL-2-view-solana-account-overview
Nov 26, 2024
Merged

chore: adds Solana support for the account overview#28411
zone-live merged 54 commits intodevelopfrom
SOL-2-view-solana-account-overview

Conversation

@zone-live
Copy link
Copy Markdown
Contributor

@zone-live zone-live commented Nov 11, 2024

Description

We added support for the Solana account overview. Now when we select a Solana address the user will be able to see its details in the home view.
Also since the overview is the same for SOL and BTC, in order to not repeat components, we've renamed as "non-evm" the existing BTC ones, and reused them.

Screenshot 2024-11-13 at 13 53 42

Related issues

Fixes:

Manual testing steps

As of right now, manually testing is a bit complex, it needs to run the snap manually and the extension, since we 1st need to publish a new release to npm with more up to date work. The snap version we have in npm is outdated and won't support this flow. That said, if you want to go ahead and run locally the steps are the following:

  1. Clone the Solana Snap monorepo and run it locally with yarn and then yarn start
  2. In the extension, at this branch, apply the following changes and run the extension as flask:
At builds.yml add the solana feature to the flask build:
 
     features:
       - build-flask
       - keyring-snaps
+      - solana

At shared/lib/accounts/solana-wallet-snap.ts point the snap ID to the snap localhost:

-export const SOLANA_WALLET_SNAP_ID: SnapId = SolanaWalletSnap.snapId as SnapId;
+//export const SOLANA_WALLET_SNAP_ID: SnapId = SolanaWalletSnap.snapId as SnapId;
+export const SOLANA_WALLET_SNAP_ID: SnapId = "local:http://localhost:8080/";
  1. Manually install the snap via the snap dapp at http://localhost:3000
  2. Enable the Solana account via Settings > Experimental > Enable Solana account
  3. Create a Solana account from the account-list menu and see the account overview of it

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@zone-live zone-live added the team-networks PRs from the Networks team label Nov 11, 2024
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@zone-live
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [9d4e4f2]
Page Load Metrics (2087 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28025621818660317
domContentLoaded17252506205419995
load17392563208720297
domInteractive268751178
backgroundConnect786332713
firstReactRender663901287335
getState563262110
initialActions01000
loadScripts12401996152219694
setupStore55715178
uiStartup193228282351247119
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 19.01 KiB (0.31%)
  • ui: 622 Bytes (0.01%)
  • common: 907 Bytes (0.01%)

@zone-live zone-live marked this pull request as ready for review November 13, 2024 13:10
@zone-live zone-live requested review from a team as code owners November 13, 2024 13:10
@zone-live zone-live changed the title chore: adds SOL support chore: adds Solana support for the account overview Nov 13, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

Comment on lines +352 to +360
const updateTimes = {
[BtcAccountType.P2wpkh]: BTC_AVG_BLOCK_TIME,
[SolAccountType.DataAccount]: SOLANA_AVG_BLOCK_TIME,
};

this.#tracker.track(account.id, BTC_AVG_BLOCK_TIME);
// NOTE: Unfortunately, we cannot update the balance right away here, because
const updateTime =
updateTimes[account.type as keyof typeof updateTimes] ||
SOLANA_AVG_BLOCK_TIME;
this.#tracker.track(account.id, updateTime); // NOTE: Unfortunately, we cannot update the balance right away here, because
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch, but actually it should uses the same values, at least for Bitcoin. Since the block time is much higher, we use this "trick" to wait blockTime / 2 to minimize the downtime.

So actually this was an error 😅

Could you re-use #getBlockTimeFor here too then? (that does not change anything for Solana block time anyway).

zone-live and others added 2 commits November 25, 2024 14:58
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
@zone-live
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

…ask/metamask-extension into SOL-2-view-solana-account-overview
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [6875fa2]
Page Load Metrics (2084 ± 104 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32325091990438210
domContentLoaded16402442204119292
load165225112084216104
domInteractive25195513617
backgroundConnect9151403919
firstReactRender893161678340
getState489242512
initialActions01000
loadScripts11831849152315977
setupStore684222311
uiStartup195530952421308148
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 900 Bytes (0.01%)
  • ui: 370 Bytes (0.00%)
  • common: 806 Bytes (0.01%)

zone-live and others added 2 commits November 25, 2024 17:28
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
@zone-live zone-live requested a review from ccharly November 25, 2024 17:58
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [785b0a1]
Page Load Metrics (2236 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25026782135467224
domContentLoaded18982573218716077
load19632688223617785
domInteractive26194513818
backgroundConnect15112492814
firstReactRender582891285024
getState789282211
initialActions01000
loadScripts13641895163013967
setupStore65616167
uiStartup212032092507258124
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 900 Bytes (0.01%)
  • ui: 370 Bytes (0.00%)
  • common: 806 Bytes (0.01%)

Copy link
Copy Markdown
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM and manually tested as well:

Screenshot 2024-11-26 at 11 23 26
Screenshot 2024-11-26 at 11 23 47
Screenshot 2024-11-26 at 11 23 56

@aganglada
Copy link
Copy Markdown
Contributor

aganglada commented Nov 26, 2024

Screenshot 2024-11-26 at 14 13 16 Screenshot 2024-11-26 at 14 13 06

Tested manually as well. Works for me

@zone-live zone-live added this pull request to the merge queue Nov 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 26, 2024
@zone-live zone-live added this pull request to the merge queue Nov 26, 2024
Merged via the queue into develop with commit be2b439 Nov 26, 2024
@zone-live zone-live deleted the SOL-2-view-solana-account-overview branch November 26, 2024 16:51
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-networks PRs from the Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants