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: added AccountWatcher as preinstalled snap and added to menu list #26402

Merged
merged 37 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
51a5320
feat: added AccountWatcher as preinstalled snap and added to menu list
k-g-j Aug 13, 2024
9293af3
feat: put 'Watch Ethereum account (Beta)' behind experimental setting…
k-g-j Aug 13, 2024
0497284
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 13, 2024
6169fe0
feat: renamed metric to 'WatchEthereumAccountsToggled'
k-g-j Aug 13, 2024
9aca5a6
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 13, 2024
9efcdff
fix: setupSentry state
k-g-j Aug 13, 2024
03a01d9
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 14, 2024
64c5b1c
feat: updated copy and changed to eye icon
k-g-j Aug 14, 2024
b14b0b0
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 14, 2024
d0aab2f
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 14, 2024
5789263
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 14, 2024
e08a9b1
feat: updated account-watcher to 4.0.3
k-g-j Aug 14, 2024
0c4d02b
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 15, 2024
0f3e0e3
feat: added width styling to the create-named-snap-account component
k-g-j Aug 15, 2024
263d596
chore: updated snapshots
k-g-j Aug 15, 2024
9192883
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 15, 2024
d3238c4
Merge remote-tracking branch 'origin/develop' into feat/add-account-w…
k-g-j Aug 15, 2024
ef465ff
fix: merge conflicts with develop
k-g-j Aug 15, 2024
bdd38c8
feat: redirect to default route from back button on snap homepage for…
k-g-j Aug 15, 2024
fd8a1c3
chore: yarn dedupe
k-g-j Aug 15, 2024
4d963aa
feat: useCallback for 'handleAddWatchAccount'
k-g-j Aug 15, 2024
d89ac15
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 16, 2024
217b60d
feat: added not removable to conditional in back button
k-g-j Aug 16, 2024
38961fd
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 16, 2024
e6c625e
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 16, 2024
3296f93
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 16, 2024
35c1736
feat: updated account-watcher to 4.1.0 with hidden flag
k-g-j Aug 16, 2024
db054fd
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 19, 2024
9674570
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 19, 2024
1bd6ac0
chore: update lavamoat
k-g-j Aug 19, 2024
6051869
Merge branch 'develop' into feat/add-account-watcher-snap
k-g-j Aug 19, 2024
bacdef4
feat: updated lavamoat policy to match develop
k-g-j Aug 19, 2024
e647d43
fix: yarn.lock
k-g-j Aug 19, 2024
43479d3
fix: yarn dedupe
k-g-j Aug 19, 2024
96f81e7
feat: updated lavamoat policies
k-g-j Aug 19, 2024
9f79954
Revert "feat: updated lavamoat policies"
k-g-j Aug 19, 2024
0efea14
Update LavaMoat policies
metamaskbot Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions app/scripts/controllers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default class PreferencesController {
useRequestQueue: true,
openSeaEnabled: true, // todo set this to true
securityAlertsEnabled: true,
watchEthereumAccountEnabled: false,
bitcoinSupportEnabled: false,
bitcoinTestnetSupportEnabled: false,
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
Expand Down Expand Up @@ -290,6 +291,18 @@ export default class PreferencesController {
}
///: END:ONLY_INCLUDE_IF

/**
* Setter for the `watchEthereumAccountEnabled` property.
*
* @param {boolean} watchEthereumAccountEnabled - Whether or not the user wants to
* enable the "Watch Ethereum account (Beta)" button.
*/
setWatchEthereumAccountEnabled(watchEthereumAccountEnabled) {
this.store.updateState({
watchEthereumAccountEnabled,
});
}

/**
* Setter for the `bitcoinSupportEnabled` property.
*
Expand Down
1 change: 1 addition & 0 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ export const SENTRY_UI_STATE = {
welcomeScreenSeen: true,
confirmationExchangeRates: true,
useSafeChainsListValidation: true,
watchEthereumAccountEnabled: false,
bitcoinSupportEnabled: false,
bitcoinTestnetSupportEnabled: false,
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
Expand Down
8 changes: 8 additions & 0 deletions app/scripts/lib/snap-keyring/account-watcher-snap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { SnapId } from '@metamask/snaps-sdk';
import AccountWatcherSnap from '@metamask/account-watcher/dist/preinstalled-snap.json';

export const ACCOUNT_WATCHER_SNAP_ID: SnapId =
AccountWatcherSnap.snapId as SnapId;

export const ACCOUNT_WATCHER_NAME: string =
AccountWatcherSnap.manifest.proposedName;
4 changes: 4 additions & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3152,6 +3152,10 @@ export default class MetamaskController extends EventEmitter {
preferencesController,
),
///: END:ONLY_INCLUDE_IF
setWatchEthereumAccountEnabled:
preferencesController.setWatchEthereumAccountEnabled.bind(
preferencesController,
),
setBitcoinSupportEnabled:
preferencesController.setBitcoinSupportEnabled.bind(
preferencesController,
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/snaps/preinstalled-snaps.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import type { PreinstalledSnap } from '@metamask/snaps-controllers';
import MessageSigningSnap from '@metamask/message-signing-snap/dist/preinstalled-snap.json';
import AccountWatcherSnap from '@metamask/account-watcher/dist/preinstalled-snap.json';
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
import BitcoinWalletSnap from '@metamask/bitcoin-wallet-snap/dist/preinstalled-snap.json';
///: END:ONLY_INCLUDE_IF

// The casts here are less than ideal but we expect the SnapController to validate the inputs.
const PREINSTALLED_SNAPS: readonly PreinstalledSnap[] = Object.freeze([
MessageSigningSnap as unknown as PreinstalledSnap,
AccountWatcherSnap as unknown as PreinstalledSnap,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
BitcoinWalletSnap as unknown as PreinstalledSnap,
///: END:ONLY_INCLUDE_IF
Expand Down
40 changes: 6 additions & 34 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,44 +174,16 @@
"crypto": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true,
"@metamask/message-signing-snap>@noble/curves": true,
"@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": {
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true,
"@metamask/utils>@scure/base": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@metamask/message-signing-snap>@noble/curves": true,
"@metamask/utils>@scure/base": true,
"@noble/hashes": true
}
},
"@ethersproject/abi": {
Expand Down
40 changes: 6 additions & 34 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,44 +174,16 @@
"crypto": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true,
"@metamask/message-signing-snap>@noble/curves": true,
"@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": {
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true,
"@metamask/utils>@scure/base": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@metamask/message-signing-snap>@noble/curves": true,
"@metamask/utils>@scure/base": true,
"@noble/hashes": true
}
},
"@ethersproject/abi": {
Expand Down
40 changes: 6 additions & 34 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,44 +174,16 @@
"crypto": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true,
"@metamask/message-signing-snap>@noble/curves": true,
"@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": {
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true,
"@metamask/utils>@scure/base": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@metamask/message-signing-snap>@noble/curves": true,
"@metamask/utils>@scure/base": true,
"@noble/hashes": true
}
},
"@ethersproject/abi": {
Expand Down
40 changes: 6 additions & 34 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,44 +174,16 @@
"crypto": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": true,
"@metamask/message-signing-snap>@noble/curves": true,
"@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32": {
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": true,
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true,
"@metamask/utils>@scure/base": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/curves": {
"globals": {
"TextEncoder": true
},
"packages": {
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": true
}
},
"@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/hashes": {
"globals": {
"TextEncoder": true,
"crypto": true
"@metamask/message-signing-snap>@noble/curves": true,
"@metamask/utils>@scure/base": true,
"@noble/hashes": true
}
},
"@ethersproject/abi": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
"@metamask-institutional/transaction-update": "^0.2.5",
"@metamask-institutional/types": "^1.1.0",
"@metamask/abi-utils": "^2.0.2",
"@metamask/account-watcher": "^4.1.0",
"@metamask/accounts-controller": "^17.2.0",
"@metamask/address-book-controller": "^4.0.1",
"@metamask/announcement-controller": "^6.1.0",
Expand Down
1 change: 1 addition & 0 deletions shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ export enum MetaMetricsEventName {
WalletSetupCanceled = 'Wallet Setup Canceled',
WalletSetupFailed = 'Wallet Setup Failed',
WalletCreated = 'Wallet Created',
WatchEthereumAccountsToggled = 'Watch Ethereum Accounts Toggled',
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
DeeplinkClicked = 'Deeplink Clicked',
ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked',
Expand Down
1 change: 1 addition & 0 deletions test/data/mock-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,7 @@
}
],
"addSnapAccountEnabled": false,
"watchEthereumAccountEnabled": false,
"bitcoinSupportEnabled": false,
"bitcoinTestnetSupportEnabled": false,
"pendingApprovals": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"useRequestQueue": true,
"openSeaEnabled": false,
"securityAlertsEnabled": "boolean",
"watchEthereumAccountEnabled": "boolean",
"bitcoinSupportEnabled": "boolean",
"bitcoinTestnetSupportEnabled": "boolean",
"addSnapAccountEnabled": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"useRequestQueue": true,
"openSeaEnabled": false,
"securityAlertsEnabled": "boolean",
"watchEthereumAccountEnabled": "boolean",
"bitcoinSupportEnabled": "boolean",
"bitcoinTestnetSupportEnabled": "boolean",
"addSnapAccountEnabled": "boolean",
Expand Down
Loading
Loading