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: SOL-46 Adds the multichain transactions controller #29129

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

zone-live
Copy link
Contributor

@zone-live zone-live commented Dec 12, 2024

Description

This is the Part 1 of the work to have SOL/BTC transactions history showing in the activity tab, this PR adds the MultichainTransactionsController that will be responsible for retrieving Txs from the snap. On the snap side, the followup logic is under development as well.
It adds already some of the necessary UI to display the Txs in the activity list.
Also bumps keyring-api so that the new keyring method listAccountTransactions is found.

Screenshot 2024-12-11 at 16 40 34

Related issues

Adds: https://consensyssoftware.atlassian.net/browse/SOL-46

Manual testing steps

Testing this is very extensive, but it you still want to give it a go these are the steps:

  1. Checkout this branch and run yarn
  2. Update the file shared/lib/accounts/solana-wallet-snap.ts with:
    export const SOLANA_WALLET_SNAP_ID: SnapId = 'local:http://localhost:8080' as SnapId;
  3. Update the file app/scripts/lib/transaction/MultichainTransactionsController.ts in L251 with:
      const mainnetTransactions = response.data.filter(
        (tx) =>
          tx.chain.startsWith(MultichainNetworks.SOLANA) ||
          tx.chain.startsWith(MultichainNetworks.SOLANA_DEVNET) ||
          tx.chain.startsWith(MultichainNetworks.BITCOIN) ||
          tx.chain.startsWith(MultichainNetworks.BITCOIN_TESTNET),
      );

We need to add the devnet/testnet here just for testing purposes.

  1. Run the extension with yarn start:flask
  2. Run the Snap: https://github.com/MetaMask/snap-solana-wallet
    • Clone it
    • Run yarn
    • Run yarn start
  3. Go to http://localhost:3000/
  4. Install the Snap
  5. In the extension, go to the Settings > Experimental > Enable Solana account
  6. Create a Solana account from the account-list menu
  7. Fund the new Solana account with some SOL, use a faucet like https://faucet.solana.com/
  8. the initial Tx with funds from the faucet will display in the activity tab
  9. But you can also do a transaction from the extension to some other address
  10. Thats it! 🎉

Screenshots/Recordings

Before

Didn't exist.

After

Note: The video already shows the Tx detail modal, but thats out of the scope of this task and is in another PR.

Screen.Recording.2024-12-17.at.12.27.40.1.mov

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.

Copy link
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.

@metamaskbot metamaskbot added the team-sol PRs from the Solana snap team label Dec 12, 2024
@zone-live zone-live changed the title SOL-46 Adds the multichain transactions controller feat: SOL-46 Adds the multichain transactions controller Dec 12, 2024
@zone-live
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
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 metamaskbot requested review from a team as code owners December 12, 2024 11:09
@metamaskbot
Copy link
Collaborator

Builds ready [a1f3d21]
Page Load Metrics (1701 ± 108 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint23721931629386185
domContentLoaded138721421677217104
load139222031701225108
domInteractive22152423015
backgroundConnect672272211
firstReactRender1674392512
getState47516199
initialActions01000
loadScripts10291651126718790
setupStore66216189
uiStartup162324061919226108
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 258.64 KiB (4.72%)
  • ui: -1.53 KiB (-0.02%)
  • common: 117.82 KiB (1.47%)

@metamaskbot
Copy link
Collaborator

Builds ready [43a89fb]
Page Load Metrics (1850 ± 76 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint49822461784336161
domContentLoaded15582161182315072
load16082252185015976
domInteractive257845168
backgroundConnect109026199
firstReactRender16102523517
getState698303115
initialActions01000
loadScripts11681623137412057
setupStore684222411
uiStartup182130732293351169
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 258.64 KiB (4.72%)
  • ui: -1.53 KiB (-0.02%)
  • common: 117.82 KiB (1.47%)

@Mariozisa1
Copy link

Fusión

@metamaskbot
Copy link
Collaborator

Builds ready [6ad4665]
Page Load Metrics (1662 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14891940166510450
domContentLoaded14431866162410249
load14811945166211153
domInteractive25163533718
backgroundConnect784362412
firstReactRender1667362210
getState55823209
initialActions01000
loadScripts1071142412298240
setupStore6491194
uiStartup17242117186711053
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -1.55 KiB (-0.02%)
  • common: 339 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [b0f3d1d]
Page Load Metrics (1688 ± 81 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39319811610320154
domContentLoaded13841969165817283
load14011983168816981
domInteractive217735178
backgroundConnect988312211
firstReactRender1578362512
getState55512136
initialActions01000
loadScripts9861527123715574
setupStore65814168
uiStartup16532226191818489

@metamaskbot
Copy link
Collaborator

Builds ready [10f0669]
Page Load Metrics (1704 ± 83 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint13972104170817785
domContentLoaded13882059167916479
load13972075170417383
domInteractive23167473215
backgroundConnect7101292613
firstReactRender1590442914
getState45112136
initialActions01000
loadScripts10181551125814670
setupStore66317199
uiStartup166727632042270129
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: -1.55 KiB (-0.02%)
  • common: 339 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d68226e]
Page Load Metrics (1662 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30118851527410197
domContentLoaded14771878163210751
load14861884166211053
domInteractive167839199
backgroundConnect877332411
firstReactRender1694372412
getState4491095
initialActions01000
loadScripts1060133011998641
setupStore6511095
uiStartup16662490190817885

@metamaskbot
Copy link
Collaborator

Builds ready [f1a0a22]
Page Load Metrics (1839 ± 152 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint24022421455608292
domContentLoaded141027641817317152
load146127941839316152
domInteractive25151523014
backgroundConnect95425168
firstReactRender15119483015
getState55418168
initialActions01000
loadScripts100621491357255122
setupStore690212512
uiStartup170431492197462222

…github.com:MetaMask/metamask-extension into SOL-46-adds-the-multichain-transactions-controller
@metamaskbot
Copy link
Collaborator

Builds ready [ac7c72c]
Page Load Metrics (1740 ± 80 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15132316174416680
domContentLoaded15052303171616880
load15132311174016780
domInteractive279741178
backgroundConnect872252010
firstReactRender1599482713
getState487202411
initialActions01000
loadScripts10281782128015374
setupStore65515168
uiStartup176826182009209100

shared/types/multichain/transactions.ts Outdated Show resolved Hide resolved
ui/selectors/multichain.ts Outdated Show resolved Hide resolved
shared/types/multichain/transactions.ts Outdated Show resolved Hide resolved
shared/types/multichain/transactions.ts Outdated Show resolved Hide resolved
Copy link
Member

@Mrtenz Mrtenz left a comment

Choose a reason for hiding this comment

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

Can you move the controller/tracker to MetaMask/core, so it can be reused for mobile as well? I think generally we shouldn't add new controllers to the extension repo directly.

@zone-live
Copy link
Contributor Author

Can you move the controller/tracker to MetaMask/core, so it can be reused for mobile as well? I think generally we shouldn't add new controllers to the extension repo directly.

@Mrtenz this will happen for sure, it will all be moved to Core repo as follow-up work, it's currently in the extension to speed up our development and make iteration faster.

@metamaskbot
Copy link
Collaborator

Builds ready [f91ef32]
Page Load Metrics (1604 ± 47 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28418271535305146
domContentLoaded1385181215789345
load1389182516049947
domInteractive238136168
backgroundConnect794322512
firstReactRender16103503215
getState48715189
initialActions00000
loadScripts992135511559244
setupStore676192411
uiStartup158125181955272131

Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be based on one of the polling controllers available here: https://github.com/MetaMask/core/tree/main/packages/polling-controller/src

Copy link
Contributor Author

@zone-live zone-live Jan 9, 2025

Choose a reason for hiding this comment

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

Will look into that now that it's being moved to Core 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-sol PRs from the Solana snap team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants